Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Not A Bug
-
2.18.0
-
None
-
None
Description
It seems that not "well behaved" consumers can cause messages to get stuck in a delivering-status on a queue. It seems like the following can occur (sample code follows):
1) Create a xa-connection/xa-session to an Artemis broker
2) Create a consumer on a queue on this Broker.
3) Start the "xa-transaction"
4) Consume a message
5) End the "xa-transaction"
6) Initiate a "xa-prepare" for the two-phase commit
7) DO NOT initiate a "xa-commit" (the consumer is not wel behaved or gets killed half way through the process etc.).
In code (partial and based on the XAReceiveExample from the Artemis-samples):
try (final XAConnection xaconnection = createXAConnection(xacf); final XASession xaSession = createXASession(xaconnection)) { final MessageConsumer consumer = xaSession.createConsumer(queue); final Xid xid = createXid(); final XAResource xaRes = xaSession.getXAResource(); xaRes.start(xid, XAResource.TMNOFLAGS); final Message message = consumer.receive(2000); System.out.println("MESSAGE CONSUMED [" + message.getJMSMessageID() + "]"); xaRes.end(xid, XAResource.TMSUCCESS); xaRes.prepare(xid); //xaRes.commit(xid, false); System.out.println("MESSAGE SORT OF COMMITTED [" + message.getJMSMessageID() + "]"); }
After this the message seems to be stuck on the queue because it is still being delivered to a consumer which is already gone. They show up in the queue metrics but the actual message/content cannot be seen, queried, consumed etc. We can see them using "artemis data exp" however.
We have the following questions:
1) Is there a way to get these messages out of this state, i..e. route them to an expiry-queue after 24 hours or manualy ?
2) Is there (apart from "artemis data exp") a way to see the content ?