0

I have difficulty understanding how to best partition a complex route in Apache Camel. In particular:

  • Does the exchange pattern (In, Out, InOut) influence if an error along the route is propagated back to the caller? And if so, does it influence if a transactional caller performs a rollback?
  • Does calling a SEDA sub-route along a route effectively terminate an InOut exchange at that point, or does the SEDA caller block to wait for a reply from the asynchronous SEDA route?

To illustrate with a concrete example:

I have a Mail consumer endpoint; i.e., the Mail component polls the inbox and creates a Camel message whenever a new email arrives. The component is configured to mark messages as read and to move them to another folder. In my setup, each resulting Camel-Mail exchange goes through several processors connected via direct: routes.

By default, the exchange generated by the Mail component is InOut and - it appears - transactional. That is, if something goes wrong along the route, the Mail component performs a rollback, keeps the email in the inbox and marks it as unread - which then triggers the route anew, for an endless error loop...

What I would like to achieve is to split the route: After a certain point, a processing error should not propagate back to the Mail component and trigger a rollback. To do that, do I

  • mark the exchange as InOnly?
  • insert a seda: route at some point, with the idea that the initial InOut route returns at this point?
  • wrap the entire route into a custom error handler?
  • somehow (how?) configure the Mail component to not act transactional?
  • something else?

From this question, I feel that I am somehow still lacking a thorough understanding of how Camel direct routing, seda routing, transactions, error handling, and exchange patterns interact.

Ulrich Schuster
  • 1,670
  • 15
  • 24

0 Answers0