I have a scenario where we have multiple Bounded Contexts, each of these contexts runs as a separate web application. All of these contexts use the Axon framework.
If an event is produced in one of these BC’s, the expectation is that it should be published to all of the BC’s, then the subscribing bounded context will decide if any action needs to be taken based on the event or not.
For this we use the Fanout exchange, using the fanout exchange and a single queue, i have observed that, once a event listeners picks the message off the queue, none of the other listeners able able to get a copy of the message.
So this configuration leads to a scenario where only one of the BC’s can react to the event, as none of the other BC’s are notified.
So we have tried a alternate configuration which works for us, just wanted to confirm if that is the “best practice”
Configure the exchange of each BC to publish the message on multiple queue’s (one queue per BC), each BC Axon terminal listens to only one queue (the queue specific to itself)
so if we have 2 BC saying BC PatientCare and BC PatientAdmission.
The the exchange in both of these application will publish on both PatientCare and PatientAdmission.
The Axon terminal on BC PatientCare will listen only to the PatientCare Queue and similarly the Axon terminal on BC PatientAdmission will listen only to the PatientAdmission Queue.
Please let me know if this sounds ok, or whether we should consider topics or some other mechanism.