Consumer not closing under transaction

Solution Verified - Updated -


  • When working with transactions a consumer is not closing after a session has been commited

This issue occurs in the following scenario:

  • Create producer
  • Create consumer
  • Send message to queue
  • Commit session
  • Send a new message
  • Close the consumer
  • Start a new consumer
  • Try to receive the message

Normally you would not want the consumer to close until the transaction completes however in this case the consumer did not acknowledged any messages. When the second consumer is started, the messages have already been prefetched by the first consumer and are no longer made available to any other consumers. The first consumer is not closed as a new transaction was started when the second message was sent and is still considered part of the new transaction.


  • JBoss Fuse A-MQ 6.0
  • ActiveMQ 5.8 and earlier

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content