I have a UI component that needs to be as up to date as possible.
The system is a trading order management system with a shared blotter. The blotter is used by a group of traders to see orders flowing from fund managers. The traders then trade in the market (outside the system) and update the order statuses.
So I have a service for FundOrder and another for the Blotter. FundManagers create orders and Traders update them. The Blotter essentially represents the overall state of Orders broken down by various categories. The blotter has value data representing the categories and the assignment of Traders.
So for Blotter I have a Service, a PersistentEntity and a PersistentReadSide I also want a UI that is super responsive.
My thought is.
- Trader logs in
- connects to BlotterService and reads latest version of Blotter from PersistentReadSide
- Connects to BlotterService and obtains a connection to the stream of events being produced by BlotterPersistentEntity - through kafka topic
- UI model takes the model from readside applies events from topic to produce an up to date model and continues to update the model as time progresses only using the PersistentReadSide again to start up.
So this needs versioning but is occurs to me that the offset is the version.
If the PersistentReadSide writes the last processed offset into the readModel that is sent to UI then the UI can subscribe to events after that offset from the topic bringing itself quickly up to date without needing to deal with any events not already dealt with by the PersistentReadSide.
- Does this make sense in general?
- Any Examples or experiences?
- Are there potential issues with using the offset as a version, gotchas etc?
- Thoughts on using broker vs pub-sub for the stream directed to client?
I know that it looks like I’m building two read sides here but they are both contributing. One is persistent and doing the heavy lifting of keeping the blotter up to date over years. The other is simply bringing the UI up to date over the last few seconds.