public void HeaderBinding()
        {
            var headersExchange = new HeadersExchange("h");
            var headerKey       = "headerKey";
            var binding         = BindingBuilder.Bind(queue).To(headersExchange).Where(headerKey).Exists();

            Assert.NotNull(binding);
            Assert.Equal(headersExchange.ExchangeName, binding.Exchange);
            Assert.Equal(Binding.DestinationType.QUEUE, binding.Type);
            Assert.Equal(queue.QueueName, binding.Destination);
            Assert.Equal(string.Empty, binding.RoutingKey);
        }
Esempio n. 2
0
        public AbstractExchange Build()
        {
            AbstractExchange exchange;

            if (ExchangeTypes.DIRECT.Equals(_type))
            {
                exchange = new DirectExchange(_name, _durable, _autoDelete, Arguments);
            }
            else if (ExchangeTypes.TOPIC.Equals(_type))
            {
                exchange = new TopicExchange(_name, _durable, _autoDelete, Arguments);
            }
            else if (ExchangeTypes.FANOUT.Equals(_type))
            {
                exchange = new FanoutExchange(_name, _durable, _autoDelete, Arguments);
            }
            else if (ExchangeTypes.HEADERS.Equals(_type))
            {
                exchange = new HeadersExchange(_name, _durable, _autoDelete, Arguments);
            }
            else
            {
                exchange = new CustomExchange(_name, _type, _durable, _autoDelete, Arguments);
            }

            exchange.IsInternal = _internal;
            exchange.IsDelayed  = _delayed;
            exchange.IgnoreDeclarationExceptions = _ignoreDeclarationExceptions;
            exchange.Declare = _declare;
            if (_declaringAdmins != null && _declaringAdmins.Count > 0)
            {
                exchange.SetAdminsThatShouldDeclare(_declaringAdmins.ToArray());
            }

            return(exchange);
        }
Esempio n. 3
0
 public HeadersExchangeMapConfigurer(DestinationConfigurer destination, HeadersExchange exchange)
 {
     Destination = destination;
     Exchange    = exchange;
 }
Esempio n. 4
0
 public HeadersExchangeMapConfigurer To(HeadersExchange exchange)
 {
     return(new HeadersExchangeMapConfigurer(this, exchange));
 }