Orphan connections when using transacted durable topics.
--------------------------------------------------------

                 Key: AMQNET-65
                 URL: https://issues.apache.org/activemq/browse/AMQNET-65
             Project: ActiveMQ .Net
          Issue Type: Bug
          Components: ActiveMQ Client
         Environment: Windows XP, Windows 2003
            Reporter: Demis Bellot
            Assignee: James Strachan
         Attachments: DurableTest.cs

There is a problem with the latest version of the NMS Client where if you 
attempt to commit a session right before you close it.

It is related to this problem:
http://www.nabble.com/Orphan-connections-from-.NET-clients-tf3879502s2354.html#a10994101

Other worthy mentions:
- Most of the NMS client tests with the latest v5 ActiveMQ-SNAPSHOT release. 
- The current DurableTest.cs does not actually test the number of messages 
coming back. - definitely required as v5 of ActiveMQ does not actually receive 
any messages.
- Another test should be included that attempts to reconnect with the durable 
subscriber id to catch the InvalidClientIDException

{code:Title=DurableTest.cs}
        [Test]
        public void TestMeTransactional()
        {
            count = 0;

            RegisterDurableConsumer();
            SendPersistentMessage();

            using (IConnection connection = Factory.CreateConnection())
            {
                connection.ClientId = CLIENT_ID;
                connection.Start();

                using (ISession session = connection.CreateSession(
                    AcknowledgementMode.Transactional))
                {
                    ITopic topic = session.GetTopic(TOPIC);
                    IMessageConsumer consumer = session.CreateDurableConsumer(
                        topic, CONSUMER_ID, "2 > 1", false);
                    consumer.Listener += new MessageListener(consumer_Listener);
                    /// Don't know how else to give the system enough time. 

                    System.Threading.Thread.Sleep(3000);
                    Assert.AreEqual(1, count);
                    Console.WriteLine("Count = " + count);
                    SendPersistentMessage();
                    System.Threading.Thread.Sleep(3000);
                    Assert.AreEqual(2, count);
                    Console.WriteLine("Count = " + count);

                    session.Commit();
                    //Timeout required before closing/disposing the connection 
otherwise orphan connection remains
                    //and test will fail when run the second time with a 
InvalidClientIDException: DurableClientID already connected.
                    //System.Threading.Thread.Sleep(3000); 
                    consumer.Dispose();
                    connection.Stop();
                }
            }
        }
{/code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to