Taking the example of money transfer in a banking app described in the docs, I have a question regarding a scenario.
Money transfer has 2 steps: withdrawal and deposit. Let’s say withdrawal was a success. Now while trying to deposit, it fails because the routing number is incorrect. Now I want the withdrawal to be rolled back. I’m trying to make a case where if an activity fails, the previous activities should be rolled back.
How does Temporal handle this?
Which sdk are you using. If activity B fails you can run activity that compensates already performed A. Java sdk has a built in saga class id that helps:
This file has been truncated.
* Copyright (c) 2020 Temporal Technologies, Inc. All Rights Reserved
* Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* Modifications copyright (C) 2017 Uber Technologies, Inc.
* Licensed under the Apache License, Version 2.0 (the "License"). You may not
* use this file except in compliance with the License. A copy of the License is
* located at
* or in the "license" file accompanying this file. This file is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
Thank you for responding. I’m using go sdk, and I found an example implementing the saga pattern -
samples-go/saga at main · temporalio/samples-go · GitHub.
@tihomir Hi is there any similar util exist in python SDK? I cannot locate that. Also the saga sample is not present in GitHub - temporalio/samples-python: Samples for working with the Temporal Python SDK