ARTEMIS-4726 removing scheduled msg from q via mngmnt can cause negative msg count
This commit is contained in:
parent
f64d918406
commit
1ee3e884b7
|
@ -178,7 +178,6 @@ public class ScheduledDeliveryHandlerImpl implements ScheduledDeliveryHandler {
|
|||
ref.acknowledge(tx);
|
||||
iter.remove();
|
||||
notifyScheduledReferencesUpdated();
|
||||
metrics.decrementMetrics(ref);
|
||||
return ref;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -543,6 +543,24 @@ public class ScheduledMessageTest extends ActiveMQTestBase {
|
|||
session.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testManagementDeleteById() throws Exception {
|
||||
try (ClientSessionFactory sessionFactory = createSessionFactory(locator)) {
|
||||
ClientSession session = sessionFactory.createSession(false, false, false);
|
||||
session.createQueue(new QueueConfiguration(atestq));
|
||||
ClientProducer producer = session.createProducer(atestq);
|
||||
ClientMessage messageToSend = session.createMessage(true);
|
||||
messageToSend.putLongProperty(Message.HDR_SCHEDULED_DELIVERY_TIME, System.currentTimeMillis() + 999_999_999);
|
||||
producer.send(messageToSend);
|
||||
session.commit();
|
||||
}
|
||||
|
||||
QueueControl queueControl = (QueueControl) server.getManagementService().getResource(ResourceNames.QUEUE + atestq);
|
||||
assertEquals(1, queueControl.getMessageCount());
|
||||
assertTrue(queueControl.removeMessage((long) queueControl.listScheduledMessages()[0].get("messageID")));
|
||||
assertEquals(0, queueControl.getMessageCount());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testManagementDeliveryByFilter() throws Exception {
|
||||
final String propertyValue = RandomUtil.randomString();
|
||||
|
|
Loading…
Reference in New Issue