camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: Splitting within transactions
Date Wed, 19 Sep 2012 06:35:48 GMT
You need to enable shareUnitOfWork=true, and also set
stopOnException=true on the splitter
http://camel.apache.org/splitter



On Tue, Sep 18, 2012 at 7:08 PM, ben1729 <bmumford@scottlogic.co.uk> wrote:
> I have the following route running in ServiceMix (v4.4.2) using Camel v2.8.5:
>
> from("jms:queue:msci.start")
>         .routeId("start-route")
>         .transacted()
>         .process(new Processor() {
>                         @Override
>                         public void process(Exchange exchange) throws Exception {
>                                 List<IGPSUser> users = new ArrayList<IGPSUser>();
>                                 users.add(new GPSUser("id1", "rfyId1", "name1"));
>                                 users.add(new GPSUser("id2", "rfyId2", "name2"));
>                                 users.add(new GPSUser("id3", "rfyId3", "name3"));
>
>                                 exchange.getIn().setBody(users);
>
>                                 System.out.println("Completed getting users");
>                         }
>                 })
>         .split(body())
>                  // Simulated crash of ServiceMix
>                 .process(new Processor() {
>                         @Override
>                         public void process(Exchange exchange) throws Exception {
>                                 if (((GPSUser) exchange.getIn().getBody()).getId().equals("id3"))
{
>                                         // Breakpoint here while I kill ServiceMix using
TaskManager
>                                 }
>                         }
>                 })
>                 .inOnly("jms:queue:msci.users")
>         .end()
> ;
>
> Messages are then pulled from the users queue for further processing. I am
> using a transaction hoping that either all the split messages will get to
> the users queue or none of them will (and the message will be rolled back to
> the start queue). However, I am seeing that the first two messages get
> through and rgwb ServiceMix shuts down. When I restart it (and don't kill at
> the breakpoint) all the messages are delivered (including the first two that
> got through the first time). What am I doing wrong?
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Splitting-within-transactions-tp5719539.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Mime
View raw message