Skip to content

AbstractMessageListenerContainer#doExecuteListener can cause a dropped message if using CLIENT_ACKNOWLEDGE and the container is stopped and subsequently started again. [SPR-12015] #16631

Closed
@spring-projects-issues

Description

@spring-projects-issues

James Reitz opened SPR-12015 and commented

This probably affects much later versions of Spring as well, but I haven't confirmed it yet (looks that way from comparing this class with the 4.0.4 release).

  1. configure your listener container for CLIENT_ACKNOWLEDGE acknoledgement mode, and CACHE_CONSUMER level caching.
  2. use a shared JMS connection (may not be required)
  3. call stop() on the DMLC when the listener container is in a javax.jms.MessageConsumer#receive() call.
    • If the receive() call returns with a message, the AbstractMessageLIstenerContainer#doExecuteListener() method will not process the message. It will throw a MessageRejectedWhileStoppingException which is quietly ignored.
  4. Now call start() The next message from the JMS destination is received and if processed successfully, is acknowledged. This acknowledges all previously received messages...including the one that was rejected. Thus, the rejected message is never redelivered, even though it was never processed.

It seems like, when rejecting the message, recover should be called on the JMS session. This would cause the message to be redelivered.

A work-around is to call AbstractMessageListenerContainer#setAcceptMessagesWhileStopping(true); which prevents the message from being initially rejected.

This problem was seen in a production application using Tibco, but I don't believe the problem is provider specific.


Affects: 3.1.4

Issue Links:

Referenced from: commits 902303b, 7af1e00, c082220

Backported to: 3.2.11

4 votes, 3 watchers

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)status: backportedAn issue that has been backported to maintenance branchestype: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions