I have problem with saga compensation action on camel-springboot 3.X. When I used camel 2.X on same project everything works. On version 3 when call to '/api/pay' end with error, no compensation action invoke. Same code on internal LRA implementation works. Any idea how to fix it?
from("timer:clock?period=20s")
.saga()
.setHeader("id", header(Exchange.TIMER_COUNTER))
.setHeader(Exchange.HTTP_METHOD, constant("POST"))
.log("Executing saga #${header.id}")
.to("http://localhost:7001/api/train/buy/seat")
.to("http://localhost:7003/api/flight/buy");
rest().post("/train/buy/seat")
.param().type(RestParamType.header).name("id").required(true).endParam()
.route()
.saga()
.propagation(SagaPropagation.SUPPORTS)
.option("id", header("id"))
.compensation("direct:cancelPurchase")
.log("Buying train seat #${header.id}")
.to("http://localhost:7002/api/pay?bridgeEndpoint=true&type=train")
.log("Payment for train #${header.id} done");
from("direct:cancelPurchase")
.log("Train purchase #${header.id} has been cancelled");
External LRA configuration:
camel:
service:
lra:
enabled: true
coordinator-url: http://localhost:8080
local-participant-url: http://localhost:XXXX/api
lra:
enabled: true
coordinator-url: http://localhost:8080
local-participant-url: http://localhost:XXXX/api