示例#1
0
 public Binding(Queue queue, DirectExchange exchange)
 {
     this.queue = queue.Name;
     this.exchange = exchange.Name;
     this.routingKey = "";
 }
示例#2
0
 public DirectExchangeRoutingKeyConfigurer To(DirectExchange directExchange)
 {
     return new DirectExchangeRoutingKeyConfigurer(this.queue, directExchange);
 }
        public void TestSpringWithDefaultExchangeNonImplicitBinding()
        {
            var exchange = new DirectExchange(RabbitAdmin.DEFAULT_EXCHANGE_NAME);
            this.context.ObjectFactory.RegisterSingleton("foo", exchange);
            var queueName = "test.queue";
            var queue = new Queue(queueName, false, false, false);
            this.context.ObjectFactory.RegisterSingleton("bar", queue);
            var binding = new Binding(queueName, Binding.DestinationType.Queue, exchange.Name, "test.routingKey", null);
            this.context.ObjectFactory.RegisterSingleton("baz", binding);
            this.rabbitAdmin.AfterPropertiesSet();

            try
            {
                this.rabbitAdmin.DeclareBinding(binding);
            }
            catch (AmqpIOException ex)
            {
                Exception cause = ex;
                Exception rootCause = null;
                while (cause != null)
                {
                    rootCause = cause;
                    cause = cause.InnerException;
                }

                Assert.True(rootCause.Message.Contains("code=403"));
                Assert.True(rootCause.Message.Contains("operation not permitted on the default exchange"));
            }
        }
示例#4
0
 public Binding(Queue queue, DirectExchange exchange, String routingKey)
 {
     this.queue = queue.Name;
     this.exchange = exchange.Name;
     this.routingKey = routingKey;
 }
        public void TestSpringWithDefaultExchangeImplicitBinding()
        {
            var exchange = new DirectExchange(RabbitAdmin.DEFAULT_EXCHANGE_NAME);
            this.context.ObjectFactory.RegisterSingleton("foo", exchange);
            var queueName = "test.queue";
            var queue = new Queue(queueName, false, false, false);
            this.context.ObjectFactory.RegisterSingleton("bar", queue);
            var binding = new Binding(queueName, Binding.DestinationType.Queue, exchange.Name, queueName, null);
            this.context.ObjectFactory.RegisterSingleton("baz", binding);
            this.rabbitAdmin.AfterPropertiesSet();

            this.rabbitAdmin.Initialize();

            // Pass by virtue of RabbitMQ not firing a 403 reply code for both exchange and binding declaration
            Assert.True(this.QueueExists(queue));
        }
        public void TestDeclareBindingWithDefaultExchangeImplicitBinding()
        {
            var exchange = new DirectExchange(RabbitAdmin.DEFAULT_EXCHANGE_NAME);
            var queueName = "test.queue";
            var queue = new Queue(queueName, false, false, false);
            this.rabbitAdmin.DeclareQueue(queue);
            var binding = new Binding(queueName, Binding.DestinationType.Queue, exchange.Name, queueName, null);

            this.rabbitAdmin.DeclareBinding(binding);

            // Pass by virtue of RabbitMQ not firing a 403 reply code for both exchange and binding declaration
            Assert.True(this.QueueExists(queue));
        }
        public void TestSpringWithDefaultExchange()
        {
            var exchange = new DirectExchange(RabbitAdmin.DEFAULT_EXCHANGE_NAME);
            this.context.ObjectFactory.RegisterSingleton("foo", exchange);
            this.rabbitAdmin.AfterPropertiesSet();

            this.rabbitAdmin.Initialize();

            // Pass by virtue of RabbitMQ not firing a 403 reply code
        }
        public void TestDeclareExchangeWithDefaultExchange()
        {
            var exchange = new DirectExchange(RabbitAdmin.DEFAULT_EXCHANGE_NAME);

            this.rabbitAdmin.DeclareExchange(exchange);

            // Pass by virtue of RabbitMQ not firing a 403 reply code
        }
示例#9
0
 /// <summary>The to.</summary>
 /// <param name="exchange">The exchange.</param>
 /// <returns>The direct exchange routing key configurer.</returns>
 public DirectExchangeRoutingKeyConfigurer To(DirectExchange exchange)
 {
     return(new DirectExchangeRoutingKeyConfigurer(this, exchange));
 }