in generic-examples/saga/Flight.java [26:48]
public void configure() throws Exception {
LRASagaService service = new LRASagaService();
service.setCoordinatorUrl("http://lra-coordinator");
service.setLocalParticipantUrl("http://flight");
getContext().addService(service);
rest("/api").post("/flight/buy")
.param().type(RestParamType.header).name("id").required(true).endParam()
.to("direct:buy");
from("direct:buy")
.saga()
.propagation(SagaPropagation.MANDATORY)
.option("id", header("id"))
.compensation("direct:cancelPurchase")
.log("Buying flight #${header.id}")
.removeHeaders("CamelHttp.*")
.to("http://payment/api/pay?httpMethod=POST&type=flight")
.log("Payment for flight #${header.id} done");
from("direct:cancelPurchase")
.log("Flight purchase #${header.id} has been cancelled");
}