dapr / dapr/go-sdk

Add Compensation Workflow Pattern Example

Open
#732 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
479
Forks
187
PR merge metrics
No merged PRs in 30d

Description

Similar to this compensation workflow pattern example in the java sdk, we should have an example of how to do compensation logic in go.

[Here is the example code.](https://github.com/dapr/java-sdk/tree/master/examples/src/main/java/io/dapr/examples/workflows/compensation)
[Here is the readme for it.](https://github.com/dapr/java-sdk/blob/master/examples/src/main/java/io/dapr/examples/workflows/README.md#compensation-pattern)
[Here are the docs for it.](https://github.com/dapr/docs/pull/4665)

We can still improve it after the fact, but we should have a clear example how users can implement this workflow pattern.

We can eventually add something like:
```
ctx.CallActivityWithCompensation(ctx,
"BookFlight", nil,
"CancelFlight", nil)
if err != nil {
// Compensate
return err
}
```

The ask for now is to simply show users how they can implement this pattern in an example.

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the linked Java compensation example, its README section, and the referenced Dapr docs pull request, then locate the corresponding workflow examples in this Go SDK. Done means the repository includes a clear Go example showing compensation logic for users to follow.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
distributed-systems
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.