I’m learning about Temporal and I’m trying to understand how should I design the whole system with Temporal.
So let’s say I have some system where customer makes an order with some data and manager should confirm an order.
This system will have backend component which will handle HTTP requests from the user.
After customer made an order, new Temporal workflow will be started.
Now manager opens some kind of UI to find out about pending orders. So I have to query orders and its statuses from the backend in some way.
I can see two ways of implementing it:
Maintain a separate database for orders. Temporal workflow will use activities to insert/update data in this database. Backend just uses this database. For example there could be “status” column which will reflect order status, so I can select all orders with PENDING status or something like that.
Use Visibility/Query API. It’s my understanding that Temporal workflows are persisted in the Temporal database, so I can just take advantage of it and query Temporal for all the data I need.
So basically my question is: should I build my system around Temporal or should I build my system around separate database and just use Temporal to update this database as necessary?
My initial reaction was to choose #1. However Query API was added for a reason, I guess. Or is it just some kind of escape hatch which should not be used often?