Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

That is all that is needed to configure a Camel route as being transacted. Just remember to use the transacted DSL. The rest is standard Spring XML to setup the transaction manager.

See Also

Camel 2.0 - JMS Sample

In this sample we want to listen for messages on a queue and process the messages with our business logic java code and send them along. Since its based on a unit test the destination is a mock endpoint.

First we configure the standard Spring XML to declare a JMS connection factory, a JMS transaction manager and our ActiveMQ component that we use in our routing.

Wiki Markup
{snippet:id=e1|lang=xml|url=camel/trunk/components/camel-jms/src/test/resources/org/apache/camel/component/jms/tx/TransactionMinimalConfigurationTest.xml}

And then we configure our routes. Notice that all we have to do is mark the route as transacted using the transacted tag.

Wiki Markup
{snippet:id=e2|lang=xml|url=camel/trunk/components/camel-jms/src/test/resources/org/apache/camel/component/jms/tx/TransactionMinimalConfigurationTest.xml}
Tip
titleTransacted error handler

When a route is marked as transacted using transacted Camel will automatic use the TransactionErrorHandler as Error Handler. It supports the same feature set as the DefaultErrorHandler, so you can for instance use Exception Clause as well.

See Also