Sponsor: Using RabbitMQ or Azure Service Bus in your .NET systems? Well, you could just use their SDKs and roll your own serialization, routing, outbox, retries, and telemetry. I mean, seriously, how hard could it be?
I was recently having a discussion around a system being built using Microsoft Azure. Some concepts being discussed for this system where CQRS, Event Sourcing and Message Queue. The diagram below is fairly typical when discussing CQRS and Event Sourcing.
Forgotten Option
There is nothing wrong with using a service bus to publish domain events. However, one option which is seemingly always forgotten to developers that are new to CQRS and Event Sourcing: Your event stream can be used as a message queue Other bounded contexts or projections can query/poll your event storage to retrieve new events that have been persisted. At regular intervals, the event consumer could poll your event storage requesting any number of new events based on the last event it processed. The consumer would be required to keep track of the last event it processed in order. This provides some benefits as it may not be a process that is required to be continuously running. You may be thinking: Polling? Really? If you rolled your own event storage, I could understand how this might be problematic and would likely be easier to use a service bus. Or you may want your event consumers to process the event as soon as possible. Your implementation of how to handle this is dependant on how you are currently storing your events. But the point still remains: Your event stream is a message queue. As always, context is king. Requirements and many other factors will play into how you want to handle messaging. It is another option that may fit a scenario that you run into.Event Store
