File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
src/main/java/com/uber/cadence/samples/hello Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -80,17 +80,19 @@ public static class SagaWorkflowImpl implements SagaWorkflow {
8080 public void execute () {
8181 Saga saga = new Saga (new Saga .Options .Builder ().setParallelCompensation (false ).build ());
8282 try {
83+ // The following demonstrate how to compensate sync invocations.
8384 ChildWorkflowOperation op1 = Workflow .newChildWorkflowStub (ChildWorkflowOperation .class );
8485 op1 .execute (10 );
8586 ChildWorkflowCompensation c1 = Workflow .newChildWorkflowStub (ChildWorkflowCompensation .class );
8687 saga .addCompensation (c1 ::compensate , -10 );
8788
89+ // The following demonstrate how to compensate async invocations.
8890 Promise <Void > result = Async .procedure (activity ::execute , 20 );
89- result .get ();
9091 saga .addCompensation (activity ::compensate , -20 );
92+ result .get ();
9193
92- // The following is just to demonstrate the ability of supplying arbitrary lambda as a
93- // saga compensation function. In production code please always use Workflow.getLogger
94+ // The following demonstrate the ability of supplying arbitrary lambda as a saga
95+ // compensation function. In production code please always use Workflow.getLogger
9496 // to log messages in workflow code.
9597 saga .addCompensation (() -> System .out .println ("Other compensation logic in main workflow." ));
9698 throw new RuntimeException ("some error" );
You can’t perform that action at this time.
0 commit comments