This commit is contained in:
Justin Bertram 2022-08-17 12:28:36 -05:00
commit aa11a82e0b
No known key found for this signature in database
GPG Key ID: F41830B875BB8633
2 changed files with 25 additions and 0 deletions

View File

@ -224,6 +224,9 @@ public class LastValueQueue extends QueueImpl {
if (current == ref) {
currentLastValue = true;
}
} else {
// if the ref has no last value
return true;
}
return currentLastValue;
}

View File

@ -140,6 +140,28 @@ public class LVQTest extends ActiveMQTestBase {
Assert.assertEquals(m.getBodyBuffer().readString(), "m4");
}
@Test
public void testMultipleMessagesWithoutLastValue() throws Exception {
ClientProducer producer = clientSession.createProducer(address);
ClientMessage m1 = createTextMessage(clientSession, "message1");
ClientMessage m2 = createTextMessage(clientSession, "message2");
producer.send(m1);
producer.send(m2);
Wait.assertEquals(2L, () -> server.locateQueue(qName1).getMessageCount(), 2000, 100);
ClientConsumer consumer = clientSession.createConsumer(qName1);
clientSession.start();
ClientMessage m = consumer.receive(1000);
Assert.assertNotNull(m);
m.acknowledge();
Assert.assertEquals("message1", m.getBodyBuffer().readString());
m = consumer.receive(1000);
Assert.assertNotNull(m);
m.acknowledge();
Assert.assertEquals("message2", m.getBodyBuffer().readString());
}
@Test
public void testMultipleRollback() throws Exception {
AddressSettings qs = new AddressSettings();