Hello Mueller,

I used the DB transaction, but I see that  the transaction is not rolled
back on an exception. I tried with transacted() in route instead of policy() 
but it behaved the same way. 

E.g. Exception case:The first two updates were not rolled back on failure of
the third one below: 

.to("mybatis:userMapper.updatePerson?statementType=Update") --- Passed 
.to("mybatis:userMapper.updateCertificate8?statementType=Update") ----
Passed 
.to("mybatis:userMapper.updateApplicationGroup?statementType=Update") ----
Failed 

*Am I missing anything?*

*Camel Registry*
        SimpleRegistry registry = new SimpleRegistry();
        DataSourceTransactionManager dataSourceTransactionManager = new
DataSourceTransactionManager(
        sqlSessionFactory.getConfiguration().getEnvironment()
                                                        .getDataSource());
                        
registry.put("transactionManager",dataSourceTransactionManager);
                        SpringTransactionPolicy springTransactionPolicy = new
SpringTransactionPolicy();
                
springTransactionPolicy.setTransactionManager(dataSourceTransactionManager);
                
springTransactionPolicy.setPropagationBehaviorName("PROPAGATION_REQUIRED");     
                        
registry.put("PROPAGATION_REQUIRED",springTransactionPolicy);
                        camelContext = new DefaultCamelContext(registry);
                        camelContext.setTracing(true);
                        camelContext.start();

*
Camel Route:*
                onException(JMSException.class)
                .handled(true).maximumRedeliveries(0).end();

                onException(IllegalArgumentException.class)
                .handled(true).maximumRedeliveries(0).rollback("Rolling back the
IllegalArgumentException")
                .end();

                onException(PersistenceException.class)
                .handled(true).maximumRedeliveries(0).rollback("Rolling back the
transaction")
                .end();
                
                onException(RollbackExchangeException.class)
                .handled(false).maximumRedeliveries(0).process(new
CamelTibcoMessageProcessor())
                .end();
        
        
from("tibjms:ISONE.CTS.CUSTOMER_SERVICES.CUSTOMER.UPDATE.V01?transacted=false")
                .choice()
                                
.when(simple("${in.body?.getTRANSACTION?.getEVENT} in
${properties:cts.bridge.person.action.transaction.event} "
                                                + "     &&
${in.body?.getPERSON?.getAPPLICATIONGROUPS?.getAPPLICATIONGROUP[last]?.getAPPLICATIONSHORTNAME}"
                                                + "  in
${properties:cts.bridge.person.action.application.short.name}"))
                        .policy("PROPAGATION_REQUIRED").id("PersonBridgeTx")    
                                        
                                
.*to("mybatis:userMapper.updatePerson?statementType=Update")
                                
.to("mybatis:userMapper.updateCertificate8?statementType=Update")
                                
.to("mybatis:userMapper.updateApplicationGroup?statementType=Update")
                        
.to("mybatis:userMapper.insertPersonFromCAMSCTSBridge?statementType=InsertList&executorType=batch")*
                                .endChoice()
                                .otherwise()
                                .log("The Event and or Application Name is not 
valid." )
                .end();



--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-Mybatis-2-13-1-multiple-statementTypes-in-a-batch-or-Transaction-tp5755122p5755231.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to