Try with <markRollbackOnly> in the on exception so you tell Camel both
to handle the exception but to mark the tx as rollback

On Wed, Mar 22, 2017 at 8:01 PM, hammod <[email protected]> wrote:
> I have the following routes:
>
>                  <route id="ReleasedOrdersWebService">
>                         <from uri="cxf:bean:CamelOrdersInterface" />
>                         <transacted />
>                         <multicast shareUnitOfWork="true" 
> stopOnException="true">
>                                 <to uri="direct:SaveOrderinMQChannel" />
>                                 <to 
> uri="direct:AckReceivingReleasedOrderChannel" />
>                         </multicast>
>                 </route>
>
>                 <route id="1">
>                         <from uri="direct:SaveOrderinMQChannel" />
>                         <transacted />
>                         <to 
> uri="bean:CamelbmpOrderswsImpl?method=getOrderString" />
>                         <inOnly uri="OrdersMQ" />
>                 </route>
>
>                 <route id="2">
>                         <from uri="direct:AckReceivingReleasedOrderChannel" />
>                         <to uri="bean:CamelOrderswsImpl?method=receiveOrder" 
> />
>                 </route>
>
> Now I have a general OnException:
>
>                <onException>
>                         <exception>java.lang.Exception</exception>
>                         
> <exception>org.apache.camel.CamelExchangeException</exception>
>                         
> <exception>org.apache.camel.RollbackExchangeException</exception>
>                         <handled>
>                                 <constant>true</constant>
>                         </handled>
>                         <to 
> uri="bean:CamelOrderswsImpl?method=replyWithArOnExceptions" />
>                 </onException>
>
> So if there is an exception in route 2 , I am catching this exception and
> sending it to a bean to construct a proper response message to the caller,
> but there is no rollback in route 1 (the message is being sent to the queue)
> , if I removed the general onException then there is a rollback and route 1
> is not saving the message in MQ which is what I want, how I can achieve
> those two things together ( I mean handing the exception and making a
> rollback) ?
> I tried to put an intended rollback or throw another exception in the
> onException but in this case the exception message is being sent to the
> caller, not the proper one form the bean
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Rollback-in-Multicast-after-catching-an-exception-tp5795896.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2

Reply via email to