ARTEMIS-3925 LVQ pruning nulls
Messages without a last-value property sent to an LVQ are being pruned rather than just passing through. Only messages with a non-null last-value property should be subject to pruning.
This commit is contained in:
parent
520088b8c6
commit
d158e7eff0
|
@ -224,6 +224,9 @@ public class LastValueQueue extends QueueImpl {
|
||||||
if (current == ref) {
|
if (current == ref) {
|
||||||
currentLastValue = true;
|
currentLastValue = true;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// if the ref has no last value
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return currentLastValue;
|
return currentLastValue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -140,6 +140,28 @@ public class LVQTest extends ActiveMQTestBase {
|
||||||
Assert.assertEquals(m.getBodyBuffer().readString(), "m4");
|
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
|
@Test
|
||||||
public void testMultipleRollback() throws Exception {
|
public void testMultipleRollback() throws Exception {
|
||||||
AddressSettings qs = new AddressSettings();
|
AddressSettings qs = new AddressSettings();
|
||||||
|
|
Loading…
Reference in New Issue