You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@activemq.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2021/08/18 12:58:00 UTC

[jira] [Work logged] (ARTEMIS-3423) recreated shared durable subscription is created as unshared

     [ https://issues.apache.org/jira/browse/ARTEMIS-3423?focusedWorklogId=639058&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-639058 ]

ASF GitHub Bot logged work on ARTEMIS-3423:
-------------------------------------------

                Author: ASF GitHub Bot
            Created on: 18/Aug/21 12:57
            Start Date: 18/Aug/21 12:57
    Worklog Time Spent: 10m 
      Work Description: gemmellr commented on a change in pull request #3697:
URL: https://github.com/apache/activemq-artemis/pull/3697#discussion_r691184948



##########
File path: tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/JMSSharedDurableConsumerTest.java
##########
@@ -138,4 +140,46 @@ public void testSharedDurableConsumerWithArtemisClientAndAMQPClient() throws Exc
       testSharedDurableConsumer(connection, connection2);
 
    }
+
+   @Test(timeout = 30000)
+   public void testSharedDurableConsumerWithSelector() throws JMSException {

Review comment:
       ```suggestion
      public void testSharedDurableConsumerWithSelectorChange() throws JMSException {
   ```
   Clarify it doesnt test the selector behaviour itself, only the effect of changing it.

##########
File path: tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/JMSSharedDurableConsumerTest.java
##########
@@ -138,4 +140,46 @@ public void testSharedDurableConsumerWithArtemisClientAndAMQPClient() throws Exc
       testSharedDurableConsumer(connection, connection2);
 
    }
+
+   @Test(timeout = 30000)
+   public void testSharedDurableConsumerWithSelector() throws JMSException {
+      SimpleString qName = amqpUseCoreSubscriptionNaming ? new SimpleString("SharedConsumer") : new SimpleString("SharedConsumer:global");
+      Connection connection = createConnection(true);
+      try {
+         Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+         Topic topic = session.createTopic(getTopicName());
+
+         MessageConsumer consumer = session.createSharedDurableConsumer(topic, "SharedConsumer", "a=b");
+         QueueImpl queue = (QueueImpl) server.getPostOffice().getBinding(qName).getBindable();
+         assertEquals(-1, queue.getMaxConsumers());
+         consumer.close();
+         MessageConsumer consumer2 = session.createSharedDurableConsumer(topic, "SharedConsumer", "a=b and b=c");
+         queue = (QueueImpl) server.getPostOffice().getBinding(qName).getBindable();
+         assertEquals(-1, queue.getMaxConsumers());
+      } finally {
+         connection.close();
+      }
+   }
+
+   @Test(timeout = 30000)
+   public void testUnSharedDurableConsumerWithSelector() throws JMSException {

Review comment:
       ```suggestion
      public void testDurableConsumerWithSelectorChange() throws JMSException {
   ```
   Shouldn't be in the JMSSharedDurableConsumerTest class, but rather the JMSDurableConsumerTest class. Can then go with just testDurableConsumerWithSelectorChange.

##########
File path: tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/JMSSharedDurableConsumerTest.java
##########
@@ -138,4 +140,46 @@ public void testSharedDurableConsumerWithArtemisClientAndAMQPClient() throws Exc
       testSharedDurableConsumer(connection, connection2);
 
    }
+
+   @Test(timeout = 30000)
+   public void testSharedDurableConsumerWithSelector() throws JMSException {
+      SimpleString qName = amqpUseCoreSubscriptionNaming ? new SimpleString("SharedConsumer") : new SimpleString("SharedConsumer:global");
+      Connection connection = createConnection(true);
+      try {
+         Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+         Topic topic = session.createTopic(getTopicName());
+
+         MessageConsumer consumer = session.createSharedDurableConsumer(topic, "SharedConsumer", "a=b");
+         QueueImpl queue = (QueueImpl) server.getPostOffice().getBinding(qName).getBindable();
+         assertEquals(-1, queue.getMaxConsumers());
+         consumer.close();
+         MessageConsumer consumer2 = session.createSharedDurableConsumer(topic, "SharedConsumer", "a=b and b=c");
+         queue = (QueueImpl) server.getPostOffice().getBinding(qName).getBindable();
+         assertEquals(-1, queue.getMaxConsumers());

Review comment:
       This only asserts the getMaxConsumers return didnt change, it would be better to verify the wider expected behaviour when the selector changed as well, i.e that the queue was deleted or cleared. As is this test would presumably still pass if we instead just removed the entire selector change handling it aims to test.
   
   E.g assert the queue objects differ, or send a message before creating the new consumer and validate the message count changes.

##########
File path: tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/JMSSharedDurableConsumerTest.java
##########
@@ -138,4 +140,46 @@ public void testSharedDurableConsumerWithArtemisClientAndAMQPClient() throws Exc
       testSharedDurableConsumer(connection, connection2);
 
    }
+
+   @Test(timeout = 30000)
+   public void testSharedDurableConsumerWithSelector() throws JMSException {
+      SimpleString qName = amqpUseCoreSubscriptionNaming ? new SimpleString("SharedConsumer") : new SimpleString("SharedConsumer:global");
+      Connection connection = createConnection(true);
+      try {
+         Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+         Topic topic = session.createTopic(getTopicName());
+
+         MessageConsumer consumer = session.createSharedDurableConsumer(topic, "SharedConsumer", "a=b");
+         QueueImpl queue = (QueueImpl) server.getPostOffice().getBinding(qName).getBindable();
+         assertEquals(-1, queue.getMaxConsumers());
+         consumer.close();
+         MessageConsumer consumer2 = session.createSharedDurableConsumer(topic, "SharedConsumer", "a=b and b=c");
+         queue = (QueueImpl) server.getPostOffice().getBinding(qName).getBindable();
+         assertEquals(-1, queue.getMaxConsumers());
+      } finally {
+         connection.close();
+      }
+   }
+
+   @Test(timeout = 30000)
+   public void testUnSharedDurableConsumerWithSelector() throws JMSException {
+      SimpleString qName = new SimpleString("foo.SharedConsumer");
+      Connection connection = createConnection("foo", true);
+      try {
+         Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+         Topic topic = session.createTopic(getTopicName());
+
+         MessageConsumer consumer = session.createDurableConsumer(topic, "SharedConsumer", "a=b", false);
+         QueueImpl queue = (QueueImpl) server.getPostOffice().getBinding(qName).getBindable();
+         assertEquals(1, queue.getMaxConsumers());
+         consumer.close();
+         MessageConsumer consumer2 = session.createDurableConsumer(topic, "SharedConsumer", "a=b and b=c", false);
+         queue = (QueueImpl) server.getPostOffice().getBinding(qName).getBindable();
+         assertEquals(1, queue.getMaxConsumers());

Review comment:
       Same comment around better verifying behaviour as in the other test.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: gitbox-unsubscribe@activemq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 639058)
    Time Spent: 20m  (was: 10m)

> recreated shared durable subscription is created as unshared
> ------------------------------------------------------------
>
>                 Key: ARTEMIS-3423
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-3423
>             Project: ActiveMQ Artemis
>          Issue Type: Bug
>          Components: AMQP
>            Reporter: Andy Taylor
>            Assignee: Andy Taylor
>            Priority: Major
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> This is just in the AMQP layer, if a shared durable subscription is recreated because of a change in message selector it gets created as unshared (maxconsumers=1)



--
This message was sent by Atlassian Jira
(v8.3.4#803005)