Jelmer created ARTEMIS-3526:
-------------------------------

             Summary: Messages get stuck in delivering status on a queue.
                 Key: ARTEMIS-3526
                 URL: https://issues.apache.org/jira/browse/ARTEMIS-3526
             Project: ActiveMQ Artemis
          Issue Type: Bug
          Components: Broker
    Affects Versions: 2.18.0
            Reporter: Jelmer


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).

 

In code (partial and based on the  XAReceiveExample from the Artemis-samples):
{code:java}
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() 
+ "]");
} {code}
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 contents 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 ?

 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to