Hello, I am new to Temporal and I would like to be able to track the progress of my workflow containing 2 activities so that I can display the state and progress of the workflow on my Web UI (so i can display a progress bar for each workflow and sub bar for activities inside the workflow)
I have browsed the forum multiple times about this topic but I never find a clear answer on how to proceed to achieve this.
Should i use the heartbeat ? Should i use a query ?
We solved this problem by tracking a user-facing workflow status as an entity with a database table describing it. That is, part of our workflow code looks like the following psuedo-code:
This has worked OK for us so far. In practice we’ve written a little API to make this cleaner, and it records all the steps and sub-steps that have completed, which are projected into a nice little UI.
The reasons we landed on this over something 100% dependent on Temporal were:
Our Temporal retention period is only 30 days, but we can use this to keep user-facing views for longer periods.
Our workflows end up being a lot more complex with internal details that aren’t interesting to our customers.
The Query API for Temporal is fairly fast, but notably slower than just plucking a row out of our local PostgreSQL database we’re already reading from to generate my UI.
Hope that’s helpful. I think there are a lot of valid options here that depend on your use-case and such.
Thank you for your answer, that’s really interesting and help me a lot.
Do you know (maybe you tried it) if it’s possible to track progression inside an activity.
In my case, i have a workflow with 2 activities and each activity can take approximatly 30 minutes. I would try to show progression feedback of each activity in my UI in order to show a smooth progress bar to my users (and not just 0%, 50%, 100%)
What would be the best way to do something like that ?
Thank’s again for you hep.