Saga compensation for update activity

Hi community, I am using spring boot …Taking one example, suppose i am defining one workflow with 2 activities .

Activity 1 is calling the customer name update service (Change Name from John to Peter)
Activitiy 2 is charging servicing fees

If activity 2 fails then i want to rollback activity 1 …(Change Name from Peter to John again)

I am bit stuck on how to maintain the previous name state of activity 1 …how can i store any reference for John in Temporal workflow…

Let me know if i am not clear

For Spring Boot in general we added auto-config support in Java SDK as of release 1.16.0.

Also we have a demo here.

As to your question, one way could be via your orchestration logic (your workflow code)
You can catch ActivityFailure for activity 2 (you should btw do error handling for any of your activity invocations) which is delivered to your workflow code after all activity retries are exhausted, and then can decide to invoke activity 1 again if you wanted.

If you need to retry a sequence of activities together, you can use workflow-level retries via `Workflow.retry, see sample here.