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

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

Activity

  1. spring-projects-issues commented on Jul 22, 2014

    @spring-projects-issues
    CollaboratorAuthor

    Juergen Hoeller commented

    Good point, and fixed for 4.1 RC2 now. I'll also backport this to 4.0.7 and 3.2.11.

    Juergen

  2. spring-projects-issues commented on Jul 22, 2014

    @spring-projects-issues
    CollaboratorAuthor

    James Reitz commented

    Great. Thanks Juergen!

  3. added
    type: bug
    status: backported
    in: core
    on Jan 11, 2019
  4. added this to the 4.0.7 milestone on Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

in: corestatus: backportedtype: bug

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions