Dear folks,

My questions relates to a transacted route as it is described in the Camel in Action Book in Section 9.4.3 (Returning a custom response) - my goal is, however, to return a web service fault (instead of regular response message) _and_ rollback the route.

The situation is as follows: I have a transacted camel route exposed as a web service. In case, an exception happens on the route, the exception is caught using an onException block and a custom response is returned.

My transaction handling behavior looks quite similar as in the book:

<onException>
<exception>java.lang.Exception</exception>
<handled><constant>true</constant></handled>
<transform><method bean="order" method="replyError"/></transform>
<rollback markRollbackOnly="true"/>
</onException>

However, I do not want to return a "regular response message" containing an error code, but a web service fault. I am doing this using code as follows in my corresponding bean:

exchange.getOut().setBody(new Failure(...)); // my JAXB fault type
exchange.getOut().setFault(true);

My problem is now that when calling setFault(true) on the out messsage the transaction is not rolled back according to the logs (DEBUG:Transaction commit (0x2b105d) for ExchangeId: ID-4711)

When I return a regular out message, everything works as expected and I see in the logs that the transaction is rolled back. I've already tried to use just rollback() instead of markRollbackOnly(), but without any success.

Any help would be appreciated.

Thanks,
marco

Reply via email to