Apache.NMS.Test.NMSTestSupport.RegisterDurableConsumer C# (CSharp) Method

RegisterDurableConsumer() protected method

Register a durable consumer
protected RegisterDurableConsumer ( string connectionID, string destination, string consumerID, string selector, bool noLocal ) : void
connectionID string Connection ID of the consumer.
destination string Destination name to register. Supports embedded prefix names.
consumerID string Name of the durable consumer.
selector string Selector parameters for consumer.
noLocal bool
return void
        protected void RegisterDurableConsumer(string connectionID, string destination, string consumerID, string selector, bool noLocal)
        {
            using(IConnection connection = CreateConnection(connectionID))
            {
                connection.Start();
                using(ISession session = connection.CreateSession(AcknowledgementMode.DupsOkAcknowledge))
                {
                    ITopic destinationTopic = SessionUtil.GetTopic(session, destination);
                    Assert.IsNotNull(destinationTopic, "Could not get destination topic.");
                    using(IMessageConsumer consumer = session.CreateDurableConsumer(destinationTopic, consumerID, selector, noLocal))
                    {
                        Assert.IsNotNull(consumer, "Could not create durable consumer.");
                    }
                }
            }
        }