예제 #1
0
 public RabbitBrokerAdmin(IConnectionFactory connectionFactory)
 {
     this.virtualHost = connectionFactory.VirtualHost;
     this.rabbitTemplate = new RabbitTemplate(connectionFactory);
     this.rabbitAdmin = new RabbitAdmin(rabbitTemplate);
     InitializeDefaultErlangTemplate(rabbitTemplate);
 }
예제 #2
0
 public void TestNoFailOnStartupWithMissingBroker()
 {
     var connectionFactory = new SingleConnectionFactory("foo");
     connectionFactory.Port = 434343;
     var applicationContext = new GenericApplicationContext();
     applicationContext.ObjectFactory.RegisterSingleton("foo", new Queue("queue"));
     var rabbitAdmin = new RabbitAdmin(connectionFactory);
     rabbitAdmin.ApplicationContext = applicationContext;
     rabbitAdmin.AutoStartup = true;
     rabbitAdmin.AfterPropertiesSet();
 }
예제 #3
0
        private static void Main(string[] args)
        {
            using (IConnectionFactory connectionFactory = new SingleConnectionFactory())
            {
                IAmqpAdmin amqpAdmin = new RabbitAdmin(connectionFactory);

                var helloWorldQueue = new Queue("hello.world.queue");

                amqpAdmin.DeclareQueue(helloWorldQueue);

                //Each queue is automatically bound to the default direct exchange.

                Console.WriteLine("Queue [hello.world.queue] has been declared.");
                Console.WriteLine("Press 'enter' to exit");
                Console.ReadLine();
            }
        }
        public void TestArgumentsQueue()
        {
            var queue = this.objectFactory.GetObject<Queue>("arguments");
            Assert.IsNotNull(queue);

            var template = new RabbitTemplate(new CachingConnectionFactory(BrokerTestUtils.GetPort()));
            var rabbitAdmin = new RabbitAdmin(template.ConnectionFactory);
            rabbitAdmin.DeleteQueue(queue.Name);
            rabbitAdmin.DeclareQueue(queue);

            Assert.AreEqual(100L, queue.Arguments["x-message-ttl"]);
            template.ConvertAndSend(queue.Name, "message");

            Thread.Sleep(200);
            var result = (string)template.ReceiveAndConvert(queue.Name);
            Assert.AreEqual(null, result);
        }
        public static void Configure()
        {
            using (IConnectionFactory connectionFactory = new CachingConnectionFactory())
            {
                IAmqpAdmin amqpAdmin = new RabbitAdmin(connectionFactory);

                //Each queue is automatically bound to the default direct exchange.
                amqpAdmin.DeclareQueue(new Queue(ConfigurationManager.AppSettings["STOCK_REQUEST_QUEUE_NAME"]));
                amqpAdmin.DeclareQueue(new Queue(ConfigurationManager.AppSettings["STOCK_RESPONSE_QUEUE_NAME"]));

                //handled by the java server app on startup
                //TopicExchange mktDataExchange = new TopicExchange(ConfigurationManager.AppSettings["MARKET_DATA_EXCHANGE_NAME"], false, false);
                //amqpAdmin.DeclareExchange(mktDataExchange);

                var mktDataQueue = new Queue(ConfigurationManager.AppSettings["MARKET_DATA_QUEUE_NAME"]);
                amqpAdmin.DeclareQueue(mktDataQueue);
            }
        }
예제 #6
0
        static void Main(string[] args)
        {
            using (IConnectionFactory connectionFactory = new SingleConnectionFactory())
            {
                IAmqpAdmin amqpAdmin = new RabbitAdmin(connectionFactory);

                var marketDataQueue = new Queue("APP.STOCK.MARKETDATA");
                amqpAdmin.DeclareQueue(marketDataQueue);

                amqpAdmin.DeclareQueue(new Queue("APP.STOCK.REQUEST"));
                amqpAdmin.DeclareQueue(new Queue("APP.STOCK.JOE"));

                //Each queue is automatically bound to the default direct exchange.

                Console.WriteLine("Queues and exchanges have been declared.");
                Console.WriteLine("Press 'enter' to exit");
                Console.ReadLine();
            }
        }
예제 #7
0
        public void TestFailOnFirstUseWithMissingBroker()
        {
            var connectionFactory = new SingleConnectionFactory("foo");
            connectionFactory.Port = 434343;
            var applicationContext = new GenericApplicationContext();
            applicationContext.ObjectFactory.RegisterSingleton("foo", new Queue("queue"));
            var rabbitAdmin = new RabbitAdmin(connectionFactory);
            rabbitAdmin.ApplicationContext = applicationContext;
            rabbitAdmin.AutoStartup = true;
            rabbitAdmin.AfterPropertiesSet();

            try
            {
                rabbitAdmin.DeclareQueue();
            }
            catch (Exception ex)
            {
                Assert.True(ex is AmqpIOException, "Expecting an AmqpIOException");
            }
        }
        static void Main(string[] args)
        {
            using (IConnectionFactory connectionFactory = new CachingConnectionFactory())
            {
                IAmqpAdmin amqpAdmin = new RabbitAdmin(connectionFactory);

                //Each queue is automatically bound to the default direct exchange.
                amqpAdmin.DeclareQueue(new Queue(ConfigurationManager.AppSettings["STOCK_REQUEST_QUEUE_NAME"]));
                amqpAdmin.DeclareQueue(new Queue(ConfigurationManager.AppSettings["STOCK_RESPONSE_QUEUE_NAME"]));

                TopicExchange mktDataExchange = new TopicExchange(ConfigurationManager.AppSettings["MARKET_DATA_EXCHANGE_NAME"], false, false);
                amqpAdmin.DeclareExchange(mktDataExchange);
                Queue mktDataQueue = new Queue(ConfigurationManager.AppSettings["MARKET_DATA_QUEUE_NAME"]);
                amqpAdmin.DeclareQueue(mktDataQueue);

                Console.WriteLine("Queues and exchanges have been declared.");
                Console.WriteLine("Press 'enter' to exit");
                Console.ReadLine();
            }
        }
        public void TestSendAndReceiveWithFanout()
        {
            var admin = new RabbitAdmin(this.connectionFactory);
            var exchange = new FanoutExchange("fanout");
            admin.DeclareExchange(exchange);
            this.template.Exchange = exchange.Name;

            admin.DeclareBinding(BindingBuilder.Bind(queue).To(exchange));

            this.template.Execute<object>(delegate(IModel channel)
                                         {
                                             var consumer = this.CreateConsumer(this.template);
                                             var tag = consumer.ConsumerTag;
                                             Assert.IsNotNull(tag);

                                             try
                                             {
                                                 this.template.ConvertAndSend("message");
                                                 var result = this.GetResult(consumer);
                                                 Assert.AreEqual("message", result);
                                             }
                                             finally
                                             {
                                                 try
                                                 {
                                                     channel.BasicCancel(tag);
                                                 }
                                                 catch (Exception e)
                                                 {
                                                     // TODO: this doesn't make sense. Looks like there is a bug in the rabbitmq.client code here: http://hg.rabbitmq.com/rabbitmq-dotnet-client/file/2f12b3b4d6bd/projects/client/RabbitMQ.Client/src/client/impl/ModelBase.cs#l1018
                                                     Console.WriteLine(e.Message);
                                                 }
                                             }

                                             return null;
                                         });
        }
예제 #10
0
        /// <summary>
        /// Applies this instance.
        /// </summary>
        /// <returns>Something here.</returns>
        public bool Apply()
        {
            // Check at the beginning, so this can be used as a static field
            if (this.assumeOnline)
            {
                Assume.That(brokerOnline[this.port]);
            }
            else
            {
                Assume.That(brokerOffline[this.port]);
            }

            var connectionFactory = new CachingConnectionFactory();

            try
            {
                connectionFactory.Port = this.port;
                if (!string.IsNullOrWhiteSpace(this.hostName))
                {
                    connectionFactory.Host = this.hostName;
                }

                var admin = new RabbitAdmin(connectionFactory);

                foreach (var queue in this.queues)
                {
                    var queueName = queue.Name;

                    if (this.purge)
                    {
                        Logger.Debug("Deleting queue: " + queueName);

                        // Delete completely - gets rid of consumers and bindings as well
                        try
                        {
                            admin.DeleteQueue(queueName);
                        }
                        catch (Exception ex)
                        {
                            Logger.Warn("Could not delete queue. Assuming it didn't exist.", ex);
                        }
                    }

                    if (this.IsDefaultQueue(queueName))
                    {
                        // Just for test probe.
                        try
                        {
                            admin.DeleteQueue(queueName);
                        }
                        catch (Exception ex)
                        {
                            Logger.Warn("Could not delete queue. Assuming it didn't exist.", ex);
                        }
                    }
                    else
                    {
                        admin.DeclareQueue(queue);
                    }
                }

                brokerOffline.AddOrUpdate(this.port, false);

                if (!this.assumeOnline)
                {
                    Assume.That(brokerOffline[this.port]);
                }
            }
            catch (Exception e)
            {
                Logger.Warn("Not executing tests because basic connectivity test failed", e);

                brokerOnline.AddOrUpdate(this.port, false);

                if (this.assumeOnline)
                {
                    return false;

                    // Assume.That(!(e is Exception));
                }
            }
            finally
            {
                connectionFactory.Dispose();
            }

            return true;

            // return base.Apply(base, method, target);
        }
예제 #11
0
 /// <summary>Initializes a new instance of the <see cref="AdminConnectionListener"/> class.</summary>
 /// <param name="outer">The outer.</param>
 public AdminConnectionListener(RabbitAdmin outer)
 {
     this.outer = outer;
 }
        public void TestSendAndReceiveWithTopicConsumeInBackground()
        {
            var admin = new RabbitAdmin(this.connectionFactory);
            var exchange = new TopicExchange("topic");
            admin.DeclareExchange(exchange);
            this.template.Exchange = exchange.Name;

            admin.DeclareBinding(BindingBuilder.Bind(queue).To(exchange).With("*.end"));

            var template = new RabbitTemplate(new CachingConnectionFactory());
            template.Exchange = exchange.Name;

            var consumer = this.template.Execute<BlockingQueueConsumer>(delegate(IModel channel)
            {
                var consumerinside = this.CreateConsumer(template);
                var tag = consumerinside.ConsumerTag;
                Assert.IsNotNull(tag);

                return consumerinside;
            });

            template.ConvertAndSend("foo", "message");
            var result = this.GetResult(consumer);
            Assert.AreEqual(null, result);

            this.template.ConvertAndSend("foo.end", "message");
            result = this.GetResult(consumer);
            Assert.AreEqual("message", result);

            try
            {
                consumer.Model.BasicCancel(consumer.ConsumerTag);
            }
            catch (Exception e)
            {
                // TODO: this doesn't make sense. Looks like there is a bug in the rabbitmq.client code here: http://hg.rabbitmq.com/rabbitmq-dotnet-client/file/2f12b3b4d6bd/projects/client/RabbitMQ.Client/src/client/impl/ModelBase.cs#l1018
                Console.WriteLine(e.Message);
            }
        }
        private void RebindQueue(string routingKey)
        {
            var ctx = ContextRegistry.GetContext();
            var factory =
                ctx.GetObject("ConnectionFactory") as IConnectionFactory;

            try
            {
                IAmqpAdmin amqpAdmin = new RabbitAdmin(factory);

                TopicExchange mktDataExchange = new TopicExchange("APP.STOCK.MARKETDATA", false, false);
                Spring.Messaging.Amqp.Core.Queue mktDataQueue = new Spring.Messaging.Amqp.Core.Queue("APP.STOCK.MARKETDATA");

                if (!string.IsNullOrEmpty(_currentBinding))
                    amqpAdmin.RemoveBinding(BindingBuilder.Bind(mktDataQueue).To(mktDataExchange).With(_currentBinding));

                _currentBinding = routingKey;
                if (!string.IsNullOrEmpty(_currentBinding))
                {
                    amqpAdmin.DeclareBinding(BindingBuilder.Bind(mktDataQueue).To(mktDataExchange).With(_currentBinding));
                    txtRoutingKey.Text = _currentBinding;
                }

            }
            catch (Exception ex)
            {
                log.ErrorFormat("Uncaught application exception.", ex);
            }
        }
        public void TestHardErrorAndReconnect()
        {
            var template = new RabbitTemplate(this.connectionFactory);
            var admin = new RabbitAdmin(this.connectionFactory);
            var queue = new Queue("foo");
            admin.DeclareQueue(queue);
            var route = queue.Name;

            var latch = new CountdownEvent(1);
            try
            {
                template.Execute<object>(
                    (IModel channel) =>
                    {
                        ((IChannelProxy)channel).GetConnection().ConnectionShutdown += delegate
                        {
                            Logger.Info("Error");
                            if (latch.CurrentCount > 0)
                            {
                                latch.Signal();
                            }

                            // This will be thrown on the Connection thread just before it dies, so basically ignored
                            throw new SystemException();
                        };

                        var internalTag = channel.BasicConsume(route, false, new DefaultBasicConsumer(channel));

                        // Consume twice with the same tag is a hard error (connection will be reset)
                        var internalResult = channel.BasicConsume(route, false, internalTag, new DefaultBasicConsumer(channel));
                        Assert.Fail("Expected IOException, got: " + internalResult);
                        return null;
                    });

                Assert.Fail("Expected AmqpIOException");
            }
            catch (AmqpIOException e)
            {
                // expected
            }

            template.ConvertAndSend(route, "message");
            Assert.True(latch.Wait(1000));
            var result = (string)template.ReceiveAndConvert(route);
            Assert.AreEqual("message", result);
            result = (string)template.ReceiveAndConvert(route);
            Assert.AreEqual(null, result);
        }
예제 #15
0
        /// <summary>The apply.</summary>
        /// <returns>The System.Boolean.</returns>
        public bool Apply()
        {
            // Check at the beginning, so this can be used as a static field
            if (this.assumeOnline)
            {
                Assume.That(BrokerOnline.Get(this.port));
            }
            else
            {
                Assume.That(BrokerOffline.Get(this.port));
            }

            var connectionFactory = new CachingConnectionFactory();

            try
            {
                connectionFactory.Port = this.port;
                if (!string.IsNullOrWhiteSpace(this.hostName))
                {
                    connectionFactory.Host = this.hostName;
                }

                var admin = new RabbitAdmin(connectionFactory);
                var exchange = new FederatedExchange("fedDirectRuleTest");
                exchange.BackingType = "direct";
                exchange.UpstreamSet = "upstream-set";
                admin.DeclareExchange(exchange);
                admin.DeleteExchange("fedDirectRuleTest");

                BrokerOffline.AddOrUpdate(this.port, false);

                if (!this.assumeOnline)
                {
                    Assume.That(BrokerOffline.Get(this.port));
                }
            }
            catch (Exception e)
            {
                Logger.Warn(m => m("Not executing tests because federated connectivity test failed"), e);
                BrokerOnline.AddOrUpdate(this.port, false);
                if (this.assumeOnline)
                {
                    Assume.That(e == null, "An exception occurred.");
                    return false;
                }
            }
            finally
            {
                connectionFactory.Dispose();
            }

            return true;

            // return super.apply(base, method, target);
        }
        public void TestSendAndReceiveWithFanout()
        {
            var admin = new RabbitAdmin(this.connectionFactory);
            var exchange = new FanoutExchange("fanout");
            admin.DeclareExchange(exchange);
            this.template.Exchange = exchange.Name;

            admin.DeclareBinding(BindingBuilder.Bind(queue).To(exchange));

            this.template.Execute<object>(
                delegate
                {
                    var consumer = this.CreateConsumer(this.template);
                    var tag = consumer.ConsumerTag;
                    Assert.IsNotNull(tag);

                    try
                    {
                        this.template.ConvertAndSend("message");
                        var result = this.GetResult(consumer);
                        Assert.AreEqual("message", result);
                    }
                    finally
                    {
                        consumer.Stop();
                    }

                    return null;
                });
        }
        public void Init()
        {
            this.context = new GenericApplicationContext();
            this.rabbitAdmin = new RabbitAdmin(this.connectionFactory);

            this.rabbitAdmin.DeleteQueue("test.queue");

            // Force connection factory to forget that it has been used to delete the queue
            this.connectionFactory.Dispose();

            this.rabbitAdmin.ApplicationContext = this.context;
            this.rabbitAdmin.AutoStartup = true;
        }
예제 #18
0
        private void StockForm_Load(object sender, EventArgs e)
        {
            accountNameTextBox.Text = DefaultAccountName;
            tradeQuantityNumericUpDown.Value = DefaultTradeRequestQuantity;
            txtRoutingKey.Text = DefaultRoutingKey;

            tradeOperationsGroupBox.Enabled = false;

            try
            {
                using (IConnectionFactory connectionFactory = new CachingConnectionFactory())
                {
                    IAmqpAdmin amqpAdmin = new RabbitAdmin(connectionFactory);

                    TopicExchange mktDataExchange = new TopicExchange("app.stock.marketdata", false, false);
                    amqpAdmin.DeclareExchange(mktDataExchange);
                    Spring.Messaging.Amqp.Core.Queue mktDataQueue = new Spring.Messaging.Amqp.Core.Queue("app.stock.marketdata");
                    amqpAdmin.DeclareQueue(mktDataQueue);

                    //Create the Exchange for MarketData Requests if it does not already exist.
                    //amqpAdmin.DeclareBinding(BindingBuilder.Bind(mktDataQueue).To(mktDataExchange).With(_currentBinding));
                    //Set up initial binding
                    RebindQueue(DefaultRoutingKey);
                }
            }
            catch (Exception ex)
            {
                log.ErrorFormat("Uncaught application exception.", ex);
            }
        }
예제 #19
0
        /// <summary>
        /// Applies this instance.
        /// </summary>
        /// <returns>Something here.</returns>
        /// <remarks></remarks>
        public bool Apply()
        {
            // Check at the beginning, so this can be used as a static field
            if (this.assumeOnline)
            {
                Assume.That(brokerOnline[this.port] == true);
            }
            else
            {
                Assume.That(brokerOffline[this.port] == true);
            }

            var connectionFactory = new CachingConnectionFactory();

            try
            {
                connectionFactory.Port = this.port;
                if (StringUtils.HasText(this.hostName))
                {
                    connectionFactory.Host = this.hostName;
                }

                var admin = new RabbitAdmin(connectionFactory);

                foreach (var queue in this.queues)
                {
                    var queueName = queue.Name;

                    if (this.purge)
                    {
                        logger.Debug("Deleting queue: " + queueName);

                        // Delete completely - gets rid of consumers and bindings as well
                        admin.DeleteQueue(queueName);
                    }

                    if (this.IsDefaultQueue(queueName))
                    {
                        // Just for test probe.
                        admin.DeleteQueue(queueName);
                    }
                    else
                    {
                        admin.DeclareQueue(queue);
                    }
                }

                if (brokerOffline.ContainsKey(this.port))
                {
                    brokerOffline[this.port] = false;
                }
                else
                {
                    brokerOffline.Add(this.port, false);
                }

                if (!this.assumeOnline)
                {
                    Assume.That(brokerOffline[this.port] == true);
                }

            }
            catch (Exception e)
            {
                logger.Warn("Not executing tests because basic connectivity test failed", e);
                if (brokerOnline.ContainsKey(this.port))
                {
                    brokerOnline[this.port] = false;
                }
                else
                {
                    brokerOnline.Add(this.port, false);
                }

                if (this.assumeOnline)
                {
                    // Assume.That(!(e is Exception));
                }
            }
            finally
            {
                connectionFactory.Dispose();
            }

            return true;

            // return base.Apply(base, method, target);
        }
 public void TestGetQueues()
 {
     SingleConnectionFactory connectionFactory = new SingleConnectionFactory();
     connectionFactory.Port = BrokerTestUtils.GetAdminPort();
     Queue queue = new RabbitAdmin(connectionFactory).DeclareQueue();
     Assert.AreEqual("/", connectionFactory.VirtualHost);
     List<QueueInfo> queues = brokerAdmin.GetQueues();
     Assert.AreEqual(queue.Name, queues[0].Name);
 }
        private void StockForm_Load(object sender, EventArgs e)
        {
            try
            {
                using (IConnectionFactory connectionFactory = new CachingConnectionFactory())
                {
                    IAmqpAdmin amqpAdmin = new RabbitAdmin(connectionFactory);

                    TopicExchange mktDataExchange = new TopicExchange("APP.STOCK.MARKETDATA", false, false);
                    amqpAdmin.DeclareExchange(mktDataExchange);
                    Spring.Messaging.Amqp.Core.Queue mktDataQueue = new Spring.Messaging.Amqp.Core.Queue("APP.STOCK.MARKETDATA");
                    amqpAdmin.DeclareQueue(mktDataQueue);

                    //Create the Exchange for MarketData Requests if it does not already exist.
                    //amqpAdmin.DeclareBinding(BindingBuilder.Bind(mktDataQueue).To(mktDataExchange).With(_currentBinding));
                    //Set up initial binding
                    RebindQueue("APP.STOCK.QUOTES.nasdaq.*");
                }
            }
            catch (Exception ex)
            {
                log.ErrorFormat("Uncaught application exception.", ex);
            }
        }
        public void TestSendAndReceiveWithNonDefaultExchange()
        {
            var admin = new RabbitAdmin(this.connectionFactory);
            var exchange = new TopicExchange("topic");
            admin.DeclareExchange(exchange);

            admin.DeclareBinding(BindingBuilder.Bind(queue).To(exchange).With("*.end"));

            this.template.Execute<object>(
                delegate
                {
                    var consumer = this.CreateConsumer(this.template);
                    var tag = consumer.ConsumerTag;
                    Assert.IsNotNull(tag);

                    this.template.ConvertAndSend("topic", "foo", "message");

                    try
                    {
                        var result = this.GetResult(consumer);
                        Assert.AreEqual(null, result);

                        this.template.ConvertAndSend("topic", "foo.end", "message");
                        result = this.GetResult(consumer);
                        Assert.AreEqual("message", result);
                    }
                    finally
                    {
                        consumer.Channel.BasicCancel(tag);
                    }

                    return null;
                });
        }
        public void TestMixTransactionalAndNonTransactional()
        {
            var template1 = new RabbitTemplate(this.connectionFactory);
            var template2 = new RabbitTemplate(this.connectionFactory);
            template1.ChannelTransacted = true;

            var admin = new RabbitAdmin(this.connectionFactory);
            var queue = admin.DeclareQueue();

            template1.ConvertAndSend(queue.Name, "message");

            var result = (string)template2.ReceiveAndConvert(queue.Name);
            Assert.AreEqual("message", result);

            try
            {
                template2.Execute<object>(
                    delegate(IModel channel)
                    {
                        // Should be an exception because the channel is not transactional
                        channel.TxRollback();
                        return null;
                    });
            }
            catch (Exception ex)
            {
                Assert.True(ex is AmqpIOException, "The channel is not transactional.");
            }
        }
        public void TestSendAndReceiveFromVolatileQueue()
        {
            var template = new RabbitTemplate(this.connectionFactory);

            var admin = new RabbitAdmin(this.connectionFactory);
            var queue = admin.DeclareQueue();
            template.ConvertAndSend(queue.Name, "message");
            var result = (string)template.ReceiveAndConvert(queue.Name);
            Assert.AreEqual("message", result);
        }
예제 #25
0
 /// <summary>Initializes a new instance of the <see cref="AdminConnectionListener"/> class.</summary>
 /// <param name="outer">The outer.</param>
 public AdminConnectionListener(RabbitAdmin outer) { this.outer = outer; }
        public void TestSendAndReceiveFromVolatileQueueAfterImplicitRemoval()
        {
            var template = new RabbitTemplate(this.connectionFactory);

            var admin = new RabbitAdmin(this.connectionFactory);
            var queue = admin.DeclareQueue();
            template.ConvertAndSend(queue.Name, "message");

            // Force a physical close of the channel
            this.connectionFactory.Dispose();

            try
            {
                var result = (string)template.ReceiveAndConvert(queue.Name);
                Assert.AreEqual("message", result);
            }
            catch (Exception e)
            {
                Assert.True(e is AmqpIOException);
            }
        }
        public void TestSendAndReceiveWithTopicConsumeInBackground()
        {
            var admin = new RabbitAdmin(this.connectionFactory);
            var exchange = new TopicExchange("topic");
            admin.DeclareExchange(exchange);
            this.template.Exchange = exchange.Name;

            admin.DeclareBinding(BindingBuilder.Bind(queue).To(exchange).With("*.end"));

            var template = new RabbitTemplate(new CachingConnectionFactory());
            template.Exchange = exchange.Name;

            var consumer = this.template.Execute(
                delegate
                {
                    var consumerinside = this.CreateConsumer(template);
                    var tag = consumerinside.ConsumerTag;
                    Assert.IsNotNull(tag);

                    return consumerinside;
                });

            template.ConvertAndSend("foo", "message");
            var result = this.GetResult(consumer);
            Assert.AreEqual(null, result);

            this.template.ConvertAndSend("foo.end", "message");
            result = this.GetResult(consumer);
            Assert.AreEqual("message", result);

            consumer.Stop();
        }