Currently, I'm implementing Event Driven Architecture and have a service for command (write part) and another service for query (read part).
What I'm doing right now.
- Accept a command on CommandService
- Store event and publish event on an event bus
- ReadService listens to these events and update read models
This sounds good if you listen to your own events. Let's say I listen to external event from CommandService
- Listen to event
- Process a command for this event
- Store the event that your domain generated in your event store and publish this event to event bus
- ReadService listens to these events and update read models
In this approach, I can see that there is double latency to update my read models. First latency -> CommandService time pull the event 2nd latency -> ReadService time to pull the event generated from CommandService.
I'm thinking If I update my ReadService to listen to CommandService eventstore directly without the need of event bus, then I can reduce one of this latency.
What do you think?