Two-phase reconciliation with MongoDB

That's what I think. Do you see any issues with this workaround for emulating 2-phase commit when using something like MongoDB where every operation is atomic and there is no support for transactions outside of that?

transaction_scope:
     read message from servicebus - UpdateCustomerAddress

     get customer aggregate from docdb, replay events where commited =1

     call customer.updateAddress
         validates
         creates customer address updated event
         apply event
         event store as uncommitted events

     do optimistic concurrency update against docdb pushing uncommitted events (single op                  to ensure consistency)

     publish event to service bus 

     update docdb set events just published to commited = 1 (again one 1 op - at least in    mongodb)

transaction_complete

      

NServiceBus or something that drives the external scope of transactions from the command processor infrastructure. From what I can see we should have close semantics of 2pc, but I feel like Im missing something.

+2


a source to share


1 answer


A two phase wiki page was recently added to the mongodb website. He describes the 2-PC algorithm and discusses several failure scenarios.



+2


a source







All Articles