temporalio / samples-dotnet

Samples for working with the Temporal .NET SDK
MIT License
53 stars 18 forks source link

Sample request: Saga #33

Closed cretz closed 7 months ago

cretz commented 12 months ago

Describe the solution you'd like

Basically a simple saga sample following principles in other SDKs and outlined at https://temporal.io/blog/compensating-actions-part-of-a-complete-breakfast-with-sagas and https://temporal.io/blog/saga-pattern-made-easy

aboelkassem commented 9 months ago

Hi @cretz I have created a very basic sample for Saga pattern here https://github.com/aboelkassem/temporal-saga-dotnet please let me know if it satisfies your implementation guide to be added to the samples

It basically follows up saga sample in typescript

cretz commented 9 months ago

Sure! Feel free to submit a PR. It looks like there were many things added in yours such as having saga as a separate class, compensation complete/error callbacks, not log-then-swallowing compensation errors, etc. I think for a simple example we can just have the workflow maintain a set of compensations it loops over in reverse on error to be almost exactly like the TypeScript one.

aboelkassem commented 9 months ago

Thanks @cretz for allowing me to contribute please check my PR https://github.com/temporalio/samples-dotnet/pull/46 and let me know your thoughts