protected MessageConsumer(Queue queue, bool autoAcknowledged)
        {
            this.Queue = queue;
            this.AutoAcknowledged = autoAcknowledged;

            this.MessageTypes = new List<string>();
        }
示例#2
0
        public static Queue ExchangeSubscriberInstance(Exchange exchange)
        {
            Queue queue = new Queue(exchange, "", false, true, true);
            queue.Channel.QueueBind(queue.Name, exchange.Name, "");

            return queue;
        }
示例#3
0
        public static Queue ExchangeSubscriberInstance(Exchange exchange, string[] routingKeys)
        {
            Queue queue = new Queue(exchange, "", false, true, true);
            if(!routingKeys.Any()) {
                queue.Channel.QueueBind(queue.Name, exchange.Name, "");
            }
            else {
                routingKeys.ForEach(routingKey => queue.Channel.QueueBind(queue.Name, exchange.Name, routingKey));
            }

            return queue;
        }
示例#4
0
        public static Queue ExchangeSubscriberInstance(Exchange exchange, string[] routingKeys, bool durable,
            bool exclusive, bool autoDeleted)
        {
            Queue queue = new Queue(exchange, "", durable, exclusive, autoDeleted);
            if(!routingKeys.Any()) {
                queue.Channel.QueueBind(queue.Name, exchange.Name, "");
            }
            else {
                routingKeys.ForEach(routingKey => queue.Channel.QueueBind(queue.Name, exchange.Name, routingKey));
            }

            return queue;
        }
示例#5
0
        public static Queue IndividualExchangeSubscriberInstance(Exchange exchange, string name)
        {
            AssertionConcern.NotEmpty(name, "An individual subscriber must be named.");

            Queue queue = new Queue(exchange, name, true, false, false);

            queue.Channel.QueueBind(queue.Name, exchange.Name, "");

            return queue;
        }
示例#6
0
        public static Queue IndividualExchangeSubscriberInstance(Exchange exchange, string name, string[] routingKeys)
        {
            AssertionConcern.NotEmpty(name, "An individual subscriber must be named.");

            Queue queue = new Queue(exchange, name, true, false, false);

            if(!routingKeys.Any()) {
                queue.Channel.QueueBind(queue.Name, exchange.Name, "");
            }
            else {
                routingKeys.ForEach(routingKey => queue.Channel.QueueBind(queue.Name, exchange.Name, routingKey));
            }

            return queue;
        }
        private void AttachToQueue()
        {
            Exchange exchange = Exchange.FanOutInstance(_connectionSettings, this.ExchangeName, true);

            this._queue = Queue.IndividualExchangeSubscriberInstance(exchange, this.ExchangeName + "." + this.QueueName);
        }
 public static MessageConsumer Instance(Queue queue, bool autoAcknowledged)
 {
     return new MessageConsumer(queue, autoAcknowledged);
 }
 public static MessageConsumer Instance(Queue queue)
 {
     return new MessageConsumer(queue, false);
 }
 public static MessageConsumer AutoAcknowledgedInstance(Queue queue)
 {
     return MessageConsumer.Instance(queue);
 }