You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@activemq.apache.org by GitBox <gi...@apache.org> on 2022/02/09 17:05:15 UTC

[GitHub] [activemq-artemis] clebertsuconic commented on a change in pull request #3927: ARTEMIS-3647 - OpenWire, remove rolledbackMessageRef on Ack

clebertsuconic commented on a change in pull request #3927:
URL: https://github.com/apache/activemq-artemis/pull/3927#discussion_r802894893



##########
File path: tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/amq/RedeliveryPolicyTest.java
##########
@@ -355,6 +359,53 @@ public void testMaximumRedeliveryDelay() throws Exception {
       assertTrue(policy.getNextRedeliveryDelay(Long.MAX_VALUE) == 1000);
    }
 
+   /**
+    * @throws Exception
+    */
+   @Test
+   public void testRedeliveryRefCleanup() throws Exception {
+
+      // Receive a message with the JMS API
+      RedeliveryPolicy policy = connection.getRedeliveryPolicy();
+      policy.setUseExponentialBackOff(false);
+      policy.setMaximumRedeliveries(-1);
+      policy.setRedeliveryDelay(50);
+
+      connection.start();
+      Session pSession = connection.createSession(true, Session.AUTO_ACKNOWLEDGE);
+      Session cSession = connection.createSession(true, Session.AUTO_ACKNOWLEDGE);
+      ActiveMQQueue destination = new ActiveMQQueue("TEST");
+      this.makeSureCoreQueueExist("TEST");
+      MessageProducer producer = pSession.createProducer(destination);
+      MessageConsumer consumer = cSession.createConsumer(destination);
+
+      TextMessage m;
+
+      for (int i = 0; i < 5; ++i) {
+         producer.send(pSession.createTextMessage("MessageText"));
+         pSession.commit();
+         m = (TextMessage) consumer.receive(2000);
+         assertNotNull(m);
+         cSession.rollback();
+         m = (TextMessage) consumer.receive(2000);
+         assertNotNull(m);
+         cSession.commit();
+      }
+      ServerConsumer serverConsumer = null;
+      for (ServerSession session : server.getSessions()) {
+         for (ServerConsumer sessionConsumer : session.getServerConsumers()) {
+            if (sessionConsumer.getQueue().getName().toString() == "TEST") {
+               serverConsumer = sessionConsumer;
+            }
+         }
+      }
+      AMQConsumer amqConsumer = (AMQConsumer) serverConsumer.getProtocolData();

Review comment:
       What's wrong with the accessor? It's easy enough, right?
   
   Or am I missing something?




-- 
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