public void configure()

in saga/saga-payment-service/src/main/java/org/apache/camel/example/saga/PaymentRoute.java [25:47]


    public void configure() throws Exception {

        from("jms:queue:{{example.services.payment}}")
                .routeId("payment-service")
                .saga()
                .propagation(SagaPropagation.MANDATORY)
                .option("id", header("id"))
                .compensation("direct:cancelPayment")
                .log("Paying ${header.payFor} for order #${header.id}")
                .setBody(header("JMSCorrelationID"))
                .choice()
                .when(x -> Math.random() >= 0.85)
                .log("Payment ${header.payFor} for saga #${header.id} fails!")
                .throwException(new RuntimeException("Random failure during payment"))
                .endChoice()
                .end()
                .log("Payment ${header.payFor} done for order #${header.id} with payment transaction ${body}")
                .end();

        from("direct:cancelPayment")
                .routeId("payment-cancel")
                .log("Payment for order #${header.id} has been cancelled");
    }