I have a few questions concerning consistency for event processing, both synchronous and asychronous. I have only skim read the reference guide (v2) so apologies if I have missed something from there.
What is the scope of a ‘unit of work’ with respect to consistency; does it include synchronous event handlers. i.e. if a synchronous event handler doesn’t get called due to a power failure, does the unit of work not get committed? What happens if some synchronous event handlers are called successfully, but some other handlers are not (e.g. due to a power failure)?
Would it be possible to have an event bus implementation that polls from an ‘event feed’ for all subscribed event handlers? My reasoning is that I was already considering using a polling mechanism for external subscribers (i.e. other applications, whether in the same JVM or not) using the atom feed technique suggested in ‘REST in Practice’ (chapter 7/page 189-218, ‘Using Atom for Event-Driven Systems’). The benefits of this approach that are important to me are
- events processed exactly once
- events processed in order
- these two guarantees can be realised using a web-oriented approach that doesn’t require complex message-based middleware. I am not concerned about latency in my case.
So, I am considering the viability of a polling mechanism that would work for internal subscribers in pretty much the same way as for external subscribers, to realise the above benefits mentioned above for both types of subscriber. What do I mean by internal subscribers? Well, this could be a different aggregate in the same application as the aggregate that applied the event for example.
In fact, I think both of my above questions are linked; in summary I can see how a simple ‘event feed’ polling approach could give exactly once/in order guarantees for external subscribers without introducing complex message-based middleware, but I am struggling to see how these guarantees could be ensured for internal subscribers.
Any ideas and/or implementation suggestions for this kind of ‘event feed’ polling would be appreciated.