Exemplo n.º 1
0
        internal static MessageQueue New(IModel model,
                                         IMessageTypeResolver resolver,
                                         String name,
                                         Exchange exchange,
                                         String routingKey = "")
        {
            var queue = new MessageQueue(name, model, resolver);

            exchange.Declare(model);
            model.QueueDeclare(name, true, false, false, new Dictionary<String, Object>());
            exchange.Bind(queue, model, routingKey);

            return queue;
        }
Exemplo n.º 2
0
        public void DeclareExchangeBinding(Exchange exchange, Queue queue, String routingKey = "")
        {
            if (exchange == null)
                throw new ArgumentNullException(nameof(exchange));

            if (queue == null)
                throw new ArgumentNullException(nameof(queue));

            if (routingKey == null)
                throw new ArgumentNullException(nameof(routingKey));

            if (!_bindings.Add(new ExchangeBinding(exchange, queue, routingKey)))
                throw new ArgumentException("dupicate binding detected");
        }
Exemplo n.º 3
0
 private Exchange DeclareExchange(String name, String type, Boolean isDurable)
 {
     var exchange = new Exchange(name, type, isDurable);
     _exchanges.Add(exchange);
     return exchange;
 }
Exemplo n.º 4
0
        public Boolean TryDeclareExchangeBinding(Exchange exchange, Queue queue, String routingKey = "")
        {
            if (queue == null)
                throw new ArgumentNullException(nameof(queue));

            if (routingKey == null)
                throw new ArgumentNullException(nameof(routingKey));

            return _bindings.Add(new ExchangeBinding(exchange, queue, routingKey));
        }
Exemplo n.º 5
0
 public Boolean Equals(Exchange other)
 {
     return String.Equals(Name, other.Name);
 }
Exemplo n.º 6
0
 public Boolean Equals(Exchange other)
 {
     return(String.Equals(Name, other.Name));
 }