Uploaded image for project: 'AMQ Broker'
  1. AMQ Broker
  2. ENTMQBR-3705

LVQ + non-destructive not deliverying message to existing consumer

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • AMQ 7.8.0.CR4
    • AMQ 7.7.0.GA
    • broker-core
    • None
    • Previously, if a client acknowledged a message on a non-destructive last value queue, and that message was subsequently replaced by another last value, the broker did not deliver the message to the client. This issue is resolved.
    • Documented as Resolved Issue
    • Verified in a release
    • Hide

      Add this to org.apache.activemq.artemis.tests.integration.jms.client.LVQTest

      @Test
      public void testLVQandNonDestructive() throws Exception {
         ActiveMQConnectionFactory fact = (ActiveMQConnectionFactory) getCF();
         fact.setConsumerWindowSize(0);      
      
         try (Connection connection = fact.createConnection();
              Session session = connection.createSession(false, Session.CLIENT_ACKNOWLEDGE)) {         
      
            // swapping these two lines makes the test either succeed for fail
            // Queue queue = session.createQueue("random?last-value=true");
            Queue queue = session.createQueue("random?last-value=true&non-destructive=true");
      
            MessageProducer producer = session.createProducer(queue);
            MessageConsumer consumer = session.createConsumer(queue);
      
            connection.start();
      
            TextMessage message = session.createTextMessage();
            message.setText("Message 1");
            message.setStringProperty(Message.HDR_LAST_VALUE_NAME.toString(), "A");
            producer.send(message);
      
            TextMessage tm = (TextMessage) consumer.receive(2000);
            assertNotNull(tm);
            tm.acknowledge();
            assertEquals("Message 1", tm.getText());
      
            message = session.createTextMessage();
            message.setText("Message 2");
            message.setStringProperty(Message.HDR_LAST_VALUE_NAME.toString(), "A");
            producer.send(message);
      
            tm = (TextMessage) consumer.receive(2000);
            assertNotNull(tm);
            assertEquals("Message 2", tm.getText());
         }
      }
      
      Show
      Add this to org.apache.activemq.artemis.tests.integration.jms.client.LVQTest @Test public void testLVQandNonDestructive() throws Exception { ActiveMQConnectionFactory fact = (ActiveMQConnectionFactory) getCF(); fact.setConsumerWindowSize(0); try (Connection connection = fact.createConnection(); Session session = connection.createSession( false , Session.CLIENT_ACKNOWLEDGE)) { // swapping these two lines makes the test either succeed for fail // Queue queue = session.createQueue( "random?last-value= true " ); Queue queue = session.createQueue( "random?last-value= true &non-destructive= true " ); MessageProducer producer = session.createProducer(queue); MessageConsumer consumer = session.createConsumer(queue); connection.start(); TextMessage message = session.createTextMessage(); message.setText( "Message 1" ); message.setStringProperty(Message.HDR_LAST_VALUE_NAME.toString(), "A" ); producer.send(message); TextMessage tm = (TextMessage) consumer.receive(2000); assertNotNull(tm); tm.acknowledge(); assertEquals( "Message 1" , tm.getText()); message = session.createTextMessage(); message.setText( "Message 2" ); message.setStringProperty(Message.HDR_LAST_VALUE_NAME.toString(), "A" ); producer.send(message); tm = (TextMessage) consumer.receive(2000); assertNotNull(tm); assertEquals( "Message 2" , tm.getText()); } }

      When a client acknowledges a message on a non-destructive LVQ and that message is subsequently replaced by another "last value" the broker does not deliver this message to the client.

              rhn-support-jbertram Justin Bertram
              rhn-support-toross Tom Ross
              Oleg Sushchenko Oleg Sushchenko
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: