Search in sources :

Example 16 with SpringRouteBuilder

use of org.apache.camel.spring.SpringRouteBuilder in project camel by apache.

the class QueueToQueueTransactionTest method testRollbackUsingXmlQueueToQueue.

@Test
public void testRollbackUsingXmlQueueToQueue() throws Exception {
    // configure routes and add to camel context
    context.addRoutes(new SpringRouteBuilder() {

        @Override
        public void configure() throws Exception {
            Policy required = lookup("PROPAGATION_REQUIRED_POLICY", SpringTransactionPolicy.class);
            from("activemq:queue:foo?transacted=true").policy(required).process(new ConditionalExceptionProcessor()).to("activemq:queue:bar?transacted=true");
        }
    });
    assertResult();
}
Also used : SpringTransactionPolicy(org.apache.camel.spring.spi.SpringTransactionPolicy) Policy(org.apache.camel.spi.Policy) SpringRouteBuilder(org.apache.camel.spring.SpringRouteBuilder) SpringTransactionPolicy(org.apache.camel.spring.spi.SpringTransactionPolicy) Test(org.junit.Test)

Aggregations

SpringRouteBuilder (org.apache.camel.spring.SpringRouteBuilder)16 SpringTransactionPolicy (org.apache.camel.spring.spi.SpringTransactionPolicy)10 Test (org.junit.Test)6 Exchange (org.apache.camel.Exchange)4 Processor (org.apache.camel.Processor)3 Policy (org.apache.camel.spi.Policy)3 HashSet (java.util.HashSet)2 EntityManagerFactory (javax.persistence.EntityManagerFactory)2 Query (javax.persistence.Query)2 MessageProcessed (org.apache.camel.processor.idempotent.jpa.MessageProcessed)2 Message (org.apache.camel.Message)1 NotifyBuilder (org.apache.camel.builder.NotifyBuilder)1 JpaEndpoint (org.apache.camel.component.jpa.JpaEndpoint)1 Customer (org.apache.camel.examples.Customer)1 AggregationStrategy (org.apache.camel.processor.aggregate.AggregationStrategy)1 MyAsyncComponent (org.apache.camel.processor.async.MyAsyncComponent)1