Two Phase Commit with MongoDB

Posted by mattcodes on Stack Overflow See other posts from Stack Overflow or by mattcodes
Published on 2010-04-26T20:21:47Z Indexed on 2010/04/26 20:23 UTC
Read the original article Hit count: 238

Filed under:
|

Heres what Im thinking. Do you see any issues with this workaround to emulate 2 phase commit when using something like MongoDB where each 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

© Stack Overflow or respective owner

Related posts about mongodb

Related posts about transactions