SpringTransactionPolicy requried = new SpringTransactionPolicy(lookup("PROPAGATION_REQUIRED", TransactionTemplate.class));
SpringTransactionPolicy notsupported = new SpringTransactionPolicy(lookup("PROPAGATION_NOT_SUPPORTED", TransactionTemplate.class));
SpringTransactionPolicy requirenew = new SpringTransactionPolicy(lookup("PROPAGATION_REQUIRES_NEW", TransactionTemplate.class));
Policy rollback = new Policy() {
public void beforeWrap(RouteContext routeContext, ProcessorDefinition<?> definition) {
}
public Processor wrap(RouteContext routeContext, Processor processor) {
return new DelegateProcessor(processor) {
@Override
public void process(Exchange exchange) throws Exception {
processNext(exchange);
throw new RuntimeException("rollback");
}
@Override
public String toString() {
return "rollback(" + getProcessor() + ")";
}
};
}
};
Policy catchRollback = new Policy() {
public void beforeWrap(RouteContext routeContext, ProcessorDefinition<?> definition) {
}
public Processor wrap(RouteContext routeContext, Processor processor) {
return new DelegateProcessor(processor) {