camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <>
Subject Re: Transacted routes despite missing "transacted" flag (ActiveMQ component)
Date Fri, 25 Sep 2015 15:57:29 GMT
If you just set transacted=true on a JMS route then the ACK mode is TX
and hence the message is not lost in case of an exception during
routing, as the ACK is deferred until the end.

But if you want to both consume and send to JMS queues in the same TX,
you need all that glory TX setup. And also if you want to use other
resources such as JDBC.

On Fri, Sep 25, 2015 at 5:47 PM, Stephan Burkard <> wrote:
> Hi
> Since my question below was never answered, I have attached a small example
> project that contains the 2 showcases.
> The first case is the well-known Camel-ActiveMQ configuration:
> - An ActiveMQ connection configuration with Spring jmsTransactionManager and
> SpringTransactionPolicy
> - A Camel-Route with "transacted" Flag
> - A Testclass that runs a happy message without error and an unlucky message
> where an error is injected
> As expected both cases are successful, we don't lose any messages.
> The second case is different:
> - An ActiveMQ connection configuration WITHOUT Spring jmsTransactionManager
> and SpringTransactionPolicy
> - Instead the Camel ActiveMQ component is configured as transacted and with
> <property name="lazyCreateTransactionManager" value="false"/> (see
> CAMEL-5055)
> - A Camel-Route WITHOUT "transacted" Flag
> - A Testclass that runs a happy message without error and an unlucky message
> where an error is injected
> Surprisingly both cases are successful, we don't lose any messages. I guess
> because the "lazyCreateTransactionManager" config creates a local JMS
> transaction.
> Are there technical differences between the two configurations? Are there
> consequences/downsides on using the second approach? For example when other
> Camel components are used in the route?
> I see for example the DefaultErrorHandler of Camel kicks in in the second
> case while the TransactionErrorHandler is used in the first case.
> Thanks
> Stephan
> On Mon, Feb 23, 2015 at 3:01 PM, Stephan Burkard <> wrote:
>> Hi
>> So far I always configured the Camel ActiveMQ component with a Spring
>> JmsTransactionManager etc and marked my routes explicit as "transacted"
>> since we must not lose any messages. This kind of configuration can be found
>> at various places, for example the Camel docs at
>> However, we recently ran into a strange test case where we lost messages.
>> We first suspected it to be an ActiveMQ problem that can arise during a
>> failover (because that was the test case), but Redhat support tracked it
>> down to an "interesting" behaviour of Spring JMS that arises due to the
>> configured JmsTransactionManager.
>> Therefore I created a simple test case where I removed (as recommended by
>> Redhat) the whole Spring JmsTransactionManager stuff as well as the
>> "transacted" flag on the Camel route and the route is still fully
>> transacted. The transacted flag on the JmsConfiguration of the Camel
>> ActiveMQ-Component seems to be the only needed piece to achieve this.
>> Therefore my questions:
>> 1. Does the "transacted" flag on the Camel ActiveMQ component make all
>> routes with a JMS consumer [from(activemq:...)] automatically transacted?
>> 2. Has the reduced configuration (routes without "transacted" element, no
>> "transactionManager" reference on Camel ActiveMQ component configuration, no
>> JmsTransactionManager, no SpringTransactionPolicy) any obvious side effects
>> we have to check and test?
>> Thanks a lot
>> Stephan

Claus Ibsen
----------------- @davsclaus
Camel in Action 2nd edition:

View raw message