You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@activemq.apache.org by "Ben Sudbury (JIRA)" <ji...@apache.org> on 2018/07/05 00:37:00 UTC

[jira] [Created] (ARTEMIS-1965) Exclusive queues don't work from NMS client

Ben Sudbury created ARTEMIS-1965:
------------------------------------

             Summary: Exclusive queues don't work from NMS client
                 Key: ARTEMIS-1965
                 URL: https://issues.apache.org/jira/browse/ARTEMIS-1965
             Project: ActiveMQ Artemis
          Issue Type: Bug
    Affects Versions: 2.6.2
         Environment: dotnetcore 2.0 using apache.NMS.ActiveMQ 1.7.2 on Windows 10 
            Reporter: Ben Sudbury


I tried to migrate from ActiveMQ 5.x to Artemis using my existing NMS client but was unable to because of problems with Exclusive queues.

I converted the java example of exclusive queues to c# to be sure and I'm sorry to say that this basic test failed.

I was unable to get message groups working either as a workaround though I haven't transposed a test for that.



 
{code:java}
ConnectionFactory connectionFactory = new ConnectionFactory("tcp://localhost:61616");
 
            // Step 2. Create a JMS Connection
            IConnection connection = connectionFactory.CreateConnection();
            
 
            //Step 3. Create a JMS Session
            ISession session = connection.CreateSession(AcknowledgementMode.AutoAcknowledge);
 
            //Step 4. Create a Queue Object
            IQueue queue = session.GetQueue("client.side.exclusive.queue?exclusive=true");
 
            //Step 5. Create a JMS producer
            IMessageProducer producer = session.CreateProducer(queue);
 
            //Step 6. Create 2 consumers on the queue
            IMessageConsumer consumer1 = session.CreateConsumer(queue);
            IMessageConsumer consumer2 = session.CreateConsumer(queue);
            IMessageConsumer consumer3 = session.CreateConsumer(queue);
 
            //Step 7. Start the connection
            connection.Start();
 
            //Step 8. send 30 text messages
            IMessage message = session.CreateTextMessage("My Message");
            for (int i = 0; i < 30; i++)
            {
                producer.Send(message);
            }
 
            //Step 9. ensure consumer1 gets first 20
            for (int i = 0; i < 20; i++)
            {
                IMessage consumer1Message = consumer1.Receive(TimeSpan.FromSeconds(1));
                if (consumer1Message == null)
                {
                    throw new Exception("Example FAILED - 'consumer1' should have received 20 messages - ony received " + i+1);
                }
            }
 
            Debug.WriteLine("ExclusiveQueueClientSideExample" + " 'consumer1' received 20 messages as expected");
 
             //Step 10. ensure consumer2 gets no messages yet!
             IMessage consumer2Message = consumer2.Receive(TimeSpan.FromSeconds(1));
             if (consumer2Message != null) {
                throw new Exception("Example FAILED - 'consumer2' should have not received any Messages yet!");
            }
 
            //Step 11. close consumer1
            consumer1.Close();
 
            //Step 12. ensure consumer2 receives remaining messages
            for (int i = 0; i< 10; i++) {
                consumer2Message = consumer2.Receive(TimeSpan.FromMilliseconds(500));
                if (consumer2Message == null) {
                    throw new Exception("Example FAILED - 'consumer2' should have received 10 messages" + "after consumer1 has been closed");
                }
            }
 
            Debug.WriteLine("ExclusiveQueueClientSideExample" + " 'consumer2' received 10 messages " + "as expected, after 'consumer1' has been closed");
 
            //Step 13. ensure consumer3 gets no messages yet!
            IMessage consumer3Message = consumer3.Receive(TimeSpan.FromMilliseconds(500));
            if (consumer3Message != null) {
            throw new Exception("Example FAILED - 'consumer3' should have not received any Messages yet!");
            }
 
            Debug.WriteLine("ExclusiveQueueClientSideExample" + " 'consumer3' received 0 messages " + "as expected");
{code}
 

 

 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)