Well, I just now saw all the replies to my prior thread, seems google groups doesn’t respect my setting to send immediate email to threads I start… I’ve already started the below work, which I’ll try to explain then we can pick apart
I took a shot at writing my own event dispatcher that will push events out to RabbitMQ. I know this has been discussed as overkill, but I like what Rabbit offers for my situation, and the ability to round-robin messages off a queue, etc).
The dispatcher based on Phil’s work is here: https://github.com/Vitreo/EventBunny/blob/master/src/EventBunny/EventStoreDispatcher.cs
And if you care to see the Rabbit Publisher, it’s here: https://github.com/Vitreo/EventBunny/blob/master/src/EventBunny/RabbitPublisher.cs
I am going for only-once publishing to Rabbit, with individual components handling their own subscriptions, and if catchup is required, they would have to handle that on their own, speaking directly to EventStore (at least that’s my current thinking).
I don’t intend to start at 0,0 and pump all my messages through this, I will just switch over to it live, so I only need catchup for if this dispatcher itself goes down, therefore I bypassed the initial historical read from 0,0 on first launch.
I am also doing some funky things with the messages themselves. I wanted to have them be json all the way down in Rabbit, but I didn’t want my dispatcher to have to know about all possible event types, and I wanted to preserve EventStore info in the message, such as stream id, number, etc (for catching up later, etc). So, I use naive json serialization to create an full json version of my contract, which on the subscriber side will be EventMessage.
I’m using a convention (similar to MassTransit) of Exchange per Type.FullName, so on the subscriber side I can subscribe and create a new queue bound to that exchange.
Probably the ugliest thing is that I am storing lastProcessed in an insane way currently (json to file, real-time), so as James mentioned, it’s not transactional.
Wondering what you all think, and how you’d recommend storing lastProcessed in a safer way? File System Transaction?