I’m looking for design guidance on using Temporal efficiently for a workflow that orchestrates multiple microservices sequentially in a Java/Spring Boot application.
My use case is like this:
-
Microservice A is called first
-
the response from Microservice A is used to build the request for Microservice B and stored in context.
-
the response from Microservice B is used for Microservice C and stored in context
-
and so on
So this is a strictly sequential flow where each next step depends on the previous step’s response.
A few important constraints:
-
there are no compensating API calls
-
after every microservice call, I need to persist the context pojo into a database table. Context pojo contains request and response
-
I do not update existing rows
-
each step creates a new row
-
each new row contains the accumulated history from the previous step plus the current step’s request/response
-
for example, when Microservice B completes, a new record is inserted that contains:
-
Microservice A request/response
-
Microservice B request/response
-
-
then when Microservice C completes, another new record is inserted with:
-
Microservice A request/response
-
Microservice B request/response
-
Microservice C request/response
-
I’m trying to understand the best design for this in Temporal.
My main questions are:
-
What is the recommended way to model the evolving shared data between activities when each next service depends on the previous response?
-
Should this accumulated request/response history live in workflow state, activity input/output, or be rebuilt from external persistence?
-
Is it a good pattern to persist a new database row after every consecutive microservice call from within activities?
-
Are there any determinism or replay concerns if the workflow keeps growing an in-memory context object that contains all prior request/response data?
-
For a use case like this, is a single workflow with multiple sequential activities the right design, or is there a better Temporal pattern?
-
Are there any anti-patterns to avoid when combining sequential orchestration with insert-only audit/history records?
I’m mainly looking for design guidance.