Consultor Eletrônico



Kbase P5806: Messages reappearing in queue after receive() method has been called
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   8/12/2002
Solution ID: P5806

FACT(s) (Environment):

SonicMQ 4.0

SYMPTOM(s):

Last message reappears on the JMS queue.

Duplicate last message for QueueReceiver.receive() method to receive a message in a non-transacted, auto acknowledge session.

Duplicate last message if triggering an application exception, or otherwise halting the process, after the receive() method has been called.

CAUSE:

When a client uses the AUTO_ACKNOWLEDGE mode, it is not in direct control of message acknowledgment. Since such clients cannot know for certain if a particular message has been acknowledged (meaning the client cannot know if the acknowledgment reached the broker and the broker cannot know if the client completed processing the message), they must be prepared for redelivery of the last consumed message. This can be caused by the client completing its work just prior to a failure that prevents the message acknowledgment from occurring. Only a session·s last consumed message is subject to this ambiguity. The JMSRedelivered message header field will be set for a message redelivered under these circumstances.

For AUTO_ACKNOWLEDGE with synchronous receive, we delay sending the acknowledgement until the next client receive call is made or until another method is called on the session (for example, close() ). This ensures that the application has had a chance to process the message before we acknowledge it.

FIX:

Put the QueueSession.close() call into the message consuming client program after consuming the last message.