Skip to content

Commit

Permalink
updated readme file to document compensation feature
Browse files Browse the repository at this point in the history
  • Loading branch information
Hoomanfr committed May 30, 2022
1 parent d91a5ad commit b89406d
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,13 @@ func (h *MyHandler) Handle(msg <-chan handler.HandlerMessage[*MyEvent]) error {
...
}
```
6. Compensate if all retry fails
```go
func (h *MyHandler) Compensate(msg <-chan handler.HandlerMessage[*MyEvent]) {
busMsg := <-msg
// busMsg.Message -> is type of your event(in this example it's of type *MyEvent)
// busMsg.Headers -> contains contexts' metadata published by the bus if the PropagateContextMetadata in config is set to true
// this is usefule to publish a message to notify other services to compensate the the call. the event id can be used as correlation id to track messages in other services.
...
}
```

0 comments on commit b89406d

Please sign in to comment.