1

What is the best way to visualize cadence workflow for users?

I want to show users the different steps of the workflow in a high level view (something similar to what most food delivery apps have: order placed -> preparing food -> food is on it’s way -> order delivered).

I am not interested in showing users the actual cadence activities that are executed, as i don’t want them to see the details of my workflow, i just want to visualize some kind of high level stages that are of interest to them.

One way would be to have the high level description of my workflow persisted and do the transitions of states inside the workflow code itself (upon starting activity X mark stage Y as started etc.). However i am trying to keep this concern separated from my workflow code.

Is there any other way I can achieve that?

Note: I am using the Java client with Spring boot

Maxim Fateev
  • 6,458
  • 3
  • 20
  • 35
  • “ However i am trying to keep this concern separated from my workflow code.” why you don’t want it be in workflow code? Because these high level abstraction is your business logic, the code must exist somewhere. So you want it to be outside of workflow then? – Long Quanzheng Jun 05 '22 at 04:30
  • I do agree that these high level abstractions are part of the business logic executed by the workflow, i am just afraid that these state transitions will make the workflow code hard to read/understand if they dominate the rest of the logic in the workflow. – haydar alaeddine Jun 05 '22 at 12:30
  • I was thinking maybe one way is to embed these transitions in an aggregate representing the workflow (part of the workflow state) and have something like: Order order = placeOrder(orderDetails); aggregate.orderPlaced(order); and then handle the state transitions inside the aggregate. What do you think? – haydar alaeddine Jun 05 '22 at 12:32

1 Answers1

1

Workflow represents your business logic. The high level view presented to the user is part of the business logic. So I don't see any problem with maintaining the state for this view inside the workflow and updating it when appropriate. It is a pretty common pattern found in many Cadence/Temporal workflows.

Maxim Fateev
  • 6,458
  • 3
  • 20
  • 35