activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Matthew Good (JIRA)" <jira+amq...@apache.org>
Subject [jira] [Updated] (AMQNET-424) Creating consumer with invalid selector closes connection and other listeners.
Date Mon, 01 Apr 2013 17:13:15 GMT

     [ https://issues.apache.org/jira/browse/AMQNET-424?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Matthew Good updated AMQNET-424:
--------------------------------

    Description: 
The following test illustrates the problem.  After the exception trying to create a consumer,
the connection is closed which affects other unrelated consumers and senders.  The connection
should not close and other consumers should not be closed.


{noformat}
        [Test]
        public void TestBadSelector()
        {
            ConnectionFactory factory = new ConnectionFactory("tcp://activemqhost:61616");
            IConnection conn = factory.CreateConnection();
            ISession listenerSession = conn.CreateSession(AcknowledgementMode.AutoAcknowledge);

            string listenerQueueName = "ListenerTest";
            IDestination listenerdestination = listenerSession.GetQueue(listenerQueueName);
            IMessageConsumer listenerconsumer = listenerSession.CreateConsumer(listenerdestination);
            listenerconsumer.Listener += new MessageListener(consumer_Listener);

            conn.Start();

            ISession senderSession = conn.CreateSession(AcknowledgementMode.AutoAcknowledge);
            IDestination destination = senderSession.GetQueue(listenerQueueName);
            IMessageProducer producer = senderSession.CreateProducer(destination);
            ITextMessage goodMsg = senderSession.CreateTextMessage("testGood");
            producer.Send(goodMsg);


            Thread.Sleep(1000);
            Assert.AreEqual(1, _gotMessage);


            try
            {
                ISession badListenerSession = conn.CreateSession(AcknowledgementMode.AutoAcknowledge);
                IMessageConsumer consumer2 = badListenerSession.CreateConsumer(destination,
"badSelector;too");
                Assert.Fail("Exception expected.");
            }
            catch(BrokerException   e)
            {
                Console.WriteLine(e);
            }

            ITextMessage failMsg = senderSession.CreateTextMessage("testFail");
            producer.Send(failMsg);


            Thread.Sleep(1000);
            Assert.AreEqual(2, _gotMessage);

            conn.Close();
        }

        private int _gotMessage = 0;
        void consumer_Listener(IMessage message)
        {
            _gotMessage++;
        }

{noformat}

  was:
The following test illustrates the problem.  After the exception trying to create a consumer,
the connection is closed which affects other unrelated consumers and senders.  The connection
should not close and other consumers should not be closed.



        [Test]
        public void TestBadSelector()
        {
            ConnectionFactory factory = new ConnectionFactory("tcp://activemqhost:61616");
            IConnection conn = factory.CreateConnection();
            ISession listenerSession = conn.CreateSession(AcknowledgementMode.AutoAcknowledge);

            string listenerQueueName = "ListenerTest";
            IDestination listenerdestination = listenerSession.GetQueue(listenerQueueName);
            IMessageConsumer listenerconsumer = listenerSession.CreateConsumer(listenerdestination);
            listenerconsumer.Listener += new MessageListener(consumer_Listener);

            conn.Start();

            ISession senderSession = conn.CreateSession(AcknowledgementMode.AutoAcknowledge);
            IDestination destination = senderSession.GetQueue(listenerQueueName);
            IMessageProducer producer = senderSession.CreateProducer(destination);
            ITextMessage goodMsg = senderSession.CreateTextMessage("testGood");
            producer.Send(goodMsg);


            Thread.Sleep(1000);
            Assert.AreEqual(1, _gotMessage);


            try
            {
                ISession badListenerSession = conn.CreateSession(AcknowledgementMode.AutoAcknowledge);
                IMessageConsumer consumer2 = badListenerSession.CreateConsumer(destination,
"badSelector;too");
                Assert.Fail("Exception expected.");
            }
            catch(BrokerException   e)
            {
                Console.WriteLine(e);
            }

            ITextMessage failMsg = senderSession.CreateTextMessage("testFail");
            producer.Send(failMsg);


            Thread.Sleep(1000);
            Assert.AreEqual(2, _gotMessage);

            conn.Close();
        }

        private int _gotMessage = 0;
        void consumer_Listener(IMessage message)
        {
            _gotMessage++;
        }



    
> Creating consumer with invalid selector closes connection and other listeners.
> ------------------------------------------------------------------------------
>
>                 Key: AMQNET-424
>                 URL: https://issues.apache.org/jira/browse/AMQNET-424
>             Project: ActiveMQ .Net
>          Issue Type: Bug
>          Components: NMS
>    Affects Versions: 1.5.5
>         Environment: .NET 2.0
>            Reporter: Matthew Good
>            Assignee: Jim Gomes
>
> The following test illustrates the problem.  After the exception trying to create a consumer,
the connection is closed which affects other unrelated consumers and senders.  The connection
should not close and other consumers should not be closed.
> {noformat}
>         [Test]
>         public void TestBadSelector()
>         {
>             ConnectionFactory factory = new ConnectionFactory("tcp://activemqhost:61616");
>             IConnection conn = factory.CreateConnection();
>             ISession listenerSession = conn.CreateSession(AcknowledgementMode.AutoAcknowledge);
>             string listenerQueueName = "ListenerTest";
>             IDestination listenerdestination = listenerSession.GetQueue(listenerQueueName);
>             IMessageConsumer listenerconsumer = listenerSession.CreateConsumer(listenerdestination);
>             listenerconsumer.Listener += new MessageListener(consumer_Listener);
>             conn.Start();
>             ISession senderSession = conn.CreateSession(AcknowledgementMode.AutoAcknowledge);
>             IDestination destination = senderSession.GetQueue(listenerQueueName);
>             IMessageProducer producer = senderSession.CreateProducer(destination);
>             ITextMessage goodMsg = senderSession.CreateTextMessage("testGood");
>             producer.Send(goodMsg);
>             Thread.Sleep(1000);
>             Assert.AreEqual(1, _gotMessage);
>             try
>             {
>                 ISession badListenerSession = conn.CreateSession(AcknowledgementMode.AutoAcknowledge);
>                 IMessageConsumer consumer2 = badListenerSession.CreateConsumer(destination,
"badSelector;too");
>                 Assert.Fail("Exception expected.");
>             }
>             catch(BrokerException   e)
>             {
>                 Console.WriteLine(e);
>             }
>             ITextMessage failMsg = senderSession.CreateTextMessage("testFail");
>             producer.Send(failMsg);
>             Thread.Sleep(1000);
>             Assert.AreEqual(2, _gotMessage);
>             conn.Close();
>         }
>         private int _gotMessage = 0;
>         void consumer_Listener(IMessage message)
>         {
>             _gotMessage++;
>         }
> {noformat}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message