Skip to content

Commit 8c35f38

Browse files
author
Liang Mei
committed
Review comments
1 parent 00fb46c commit 8c35f38

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/main/java/com/uber/cadence/samples/hello/HelloSaga.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff 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");

0 commit comments

Comments
 (0)