The following sample Spring config sets up a camel-activemq component
The ActiveMQConfiguration sets transacted=true and configures for a JmsTransactionManager. Also, a PooledConnectionFactory is used.
The config for a camel-jms component would be similar.
The Spring JMS javadoc on AbstractPollingMessageListenerContainer.setTransactionManager states:
Note: Consider the use of local JMS transactions instead. Simply switch the "sessionTransacted" flag to "true" in order to use a locally transacted JMS Session for the entire receive processing, including any Session operations performed by a SessionAwareMessageListener (e.g. sending a response message).
It basically advises to only set transacted=true and don't specify a TX manager. The benefit of doing so is that the cacheLevel setting will be honored when using local transactions without a configured TX manager. When a TX manager is configured, no caching happens at DMLC level and its necessary to rely on a pooled connection factory. This is discussed here.
However right now its not possible to configure the cameljms or camel-activemq component to not use an external TX manager when transacted=true is set.
Even when setting lazyCreateTransactionManager=false.
In case of camel-activemq, it still creates a default JmsTransactionManager:
In case of camel-jms it throws an exception:
We should allow for using transactions in camel-jms and camel-activemq without setting an external TX manager.
|Transition||Time In Source Status||Execution Times||Last Executer||Last Execution Date|
|87d 31m||1||Babak Vahdat||26/May/12 15:25|
|Attachment||camel-5055acknowledgeMode_SESSION_TRANSACTED_cannot_be_used_for_an_non-transacted_Session.zip [ 12530044 ]|
|Status||Open [ 1 ]||Resolved [ 5 ]|
|Resolution||Fixed [ 1 ]|
|Summary||Offer a way to not set a transaction manager in activemq-camel||Offer a way to not set a transaction manager in camel-jms|
|Assignee||Babak Vahdat [ bvahdat ]|
|Field||Original Value||New Value|
|Fix Version/s||2.10.0 [ 12317612 ]|