Hello, We have set up a Camel route using transacted(). The route comprises multiple JDBC transactions and we required some kind of transaction management to be implemented, we decided to use transacted().
The route looks like this : from("direct:updatebookauthor").tracing() .transacted("PROPAGATION_REQUIRED") .convertBodyTo(BookShelf.class) .enrich("direct:getbookauthor", new BookShelfEnrichAggregationStrategy(Action.UPDATE)) .process(new DroolsCommandTransformer<Work>("work", Work.class)).to("drools:node/ksession") .transform().simple("${body.getValue('work').newContainer}") .bean(bookShelfRepo, "update") .choice() .when(body().isNotNull()) .process(new BookCatgProcessor()) .choice() .when(body().isNotNull()) .bean(bookShelfRepo, "updateBookDept") .bean(bookShelfRepo, "updateBookCategory") .end() .choice() .when(body().isNull()) .process(new BookShelfProcessor()) .end() .end() .onException(Exception.class).markRollbackOnly(); Spring Transaction Policy Bean is created as follows: private void setupTransactionPolicy() { try{ Context initialContext = new InitialContext(); Context envContext = (Context) initialContext.lookup("java:comp/env"); DataSource ds = (DataSource) envContext.lookup("jdbc/us/wm/TraitsDs"); DataSourceTransactionManager dsm = new org.springframework.jdbc.datasource.DataSourceTransactionManager(ds); SpringTransactionPolicy stp = new org.apache.camel.spring.spi.SpringTransactionPolicy(dsm); stp.setPropagationBehaviorName("PROPAGATION_REQUIRED"); TraitHierarchyRoutes.PROPAGATION_REQUIRED_BEAN = stp; }catch(Exception e){ throw new RuntimeException("Exception while setting up spring transaction policy" + e); } } Bean is bound to Camel Registry for referencing in the route. JndiRegistry registry = (JndiRegistry)((PropertyPlaceholderDelegateRegistry)this.getContext().getRegistry()).getRegistry(); registry.bind("PROPAGATION_REQUIRED", PROPAGATION_REQUIRED_BEAN); And the issue is that the Transaction Handling not happening and is rolling back the transactions on exceptions.. We have tried with and with out setting the auto commit property to true. Also, we have tried using the transacted() alone with out onException&markRollBack. No luck. Please advice ! -- View this message in context: http://camel.465427.n5.nabble.com/Camel-transacted-route-tp5742362.html Sent from the Camel - Users mailing list archive at Nabble.com.