I made a diagram to visualize our architecture
As can be seen the backend consists out of a couple applications:
- Domain: This application runs our aggregates.
- WebSocket API: This application translates messages from our WebSocket API to Axon events, also listens for events that should be sent to specific clients.
- Some other services: We have some other services that communicate using Axon.
The loadbalancing is done by an external cloud service. In the diagram we have two instances of the WebSocket API. The clients are balanced over these two instances (can be scaled when needed).
The issue we are having is that we have to split the segment in two for these instances (or more when we scale). Because of the segmenting we can’t tell that events of an aggregate should specifically be received by one of the two instances. Ideally we should be able to tell Axon to just send the events to both instances and let us handle the rest.
