@@ -26,26 +26,23 @@ public class PaymentRoute extends RouteBuilder {
26
26
27
27
@ Override
28
28
public void configure () throws Exception {
29
-
30
- from ("jms:queue:{{example.services.payment}}" )
31
- .routeId ("payment-service" )
32
- .saga ()
33
- .propagation (SagaPropagation .MANDATORY )
34
- .option ("id" , header ("id" ))
35
- .compensation ("direct:cancelPayment" )
36
- .log ("Paying ${header.payFor} for order #${header.id}" )
37
- .setBody (header ("JMSCorrelationID" ))
38
- .choice ()
39
- .when (x -> Math .random () >= 0.85 )
40
- .log ("Payment ${header.payFor} for saga #${header.id} fails!" )
41
- .throwException (new RuntimeException ("Random failure during payment" ))
42
- .endChoice ()
43
- .end ()
44
- .log ("Payment ${header.payFor} done for order #${header.id} with payment transaction ${body}" )
45
- .end ();
29
+ from ("jms:queue:{{example.services.payment}}" )
30
+ .routeId ("payment-service" )
31
+ .saga ()
32
+ .propagation (SagaPropagation .MANDATORY )
33
+ .option ("id" , header ("id" ))
34
+ .compensation ("direct:cancelPayment" )
35
+ .log ("Paying ${header.payFor} for order #${header.id}" )
36
+ .setBody (header ("JMSCorrelationID" ))
37
+ .choice ()
38
+ .when (x -> Math .random () >= 0.85 )
39
+ .log ("Payment ${header.payFor} for saga #${header.id} fails!" )
40
+ .throwException (new RuntimeException ("Random failure during payment" ))
41
+ .end ()
42
+ .log ("Payment ${header.payFor} done for order #${header.id} with payment transaction ${body}" );
46
43
47
44
from ("direct:cancelPayment" )
48
- .routeId ("payment-cancel" )
49
- .log ("Payment for order #${header.id} has been cancelled" );
45
+ .routeId ("payment-cancel" )
46
+ .log ("Payment for order #${header.id} has been cancelled" );
50
47
}
51
48
}
0 commit comments