Camel Transacted: MQ Session closed on every commi

2019-07-27 12:44发布

问题:

I have:

  • Camel route (transacted=true), consuming from an MQ Queue
  • Using Spring's WebSphereUowTransactionManager
  • Transactionality works
  • Running on IBM Liberty

But, I get this message:

Setup of JMS message listener invoker failed for destination 'MY.QUEUE' - trying to recover. 
Cause: Local JMS transaction failed to commit; nested exception is com.ibm.msg.client.jms.DetailedIllegalStateException: 
MQJCA1020: The session is closed.
The application attempted to use a JMS session after it had closed the session.
Modify the application so that it closes the JMS session only after it has finished using the session.

This appears to be related to this other Stack Overflow question, but I've tried changing the configuration in server.xml, with no success.

回答1:

You can try setting cacheLevelName=CACHE_CONSUMER which allows to re-use the JMS consumer and avoids endless of creation/destruction of JMS resources, as indicated by the error message may be the cause.

You can see more about the importanse of cache levels on the Camel JMS documentation: http://camel.apache.org/jms