I’ve started developing with the Rebus service bus library for .NET lately, and the ease of customizing it (it’s fully open source on GitHub) has proven to be a real nice option to have.
Within a the first few hours of working with the library I knew I wanted to implement a new saga persistence provider that would more closely mirror how the NServiceBus NHibernate saga persistence works. That is, updates to a complex saga data instance should be more atomic instead of updating a single database row that contains a JSON serialized document (the default SQL persistence strategy in Rebus).
One advantage of having a more fine grained saga data structure is reducing concurrency problems when updating saga data where the saga is a scatter-gather type scenario. For example, if my saga initiates 100 requests that return 100 results, each result handler would only update a corresponding child row in the SQL saga model.
As you can see if the source file below, the implementation is quite straightforward. I haven’t completed a whole lot of testing on it – but so far no issues in limited production scenarios. Full source available in the GitHub entityframework-saga branch here.




