public void TopicBinding()
        {
            var topicExchange = new TopicExchange("t");
            var routingKey    = "r";
            var binding       = BindingBuilder.Bind(queue).To(topicExchange).With(routingKey);

            Assert.NotNull(binding);
            Assert.Equal(topicExchange.ExchangeName, binding.Exchange);
            Assert.Equal(Binding.DestinationType.QUEUE, binding.Type);
            Assert.Equal(queue.QueueName, binding.Destination);
            Assert.Equal(routingKey, binding.RoutingKey);
        }
Exemple #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);
        }
Exemple #3
0
 public TopicExchangeRoutingKeyConfigurer To(TopicExchange exchange)
 {
     return(new TopicExchangeRoutingKeyConfigurer(this, exchange));
 }
Exemple #4
0
 public TopicExchangeRoutingKeyConfigurer(DestinationConfigurer destination, TopicExchange exchange)
     : base(destination, exchange.ExchangeName)
 {
 }