继承人的想法。您是否看到使用此类变通方法的任何问题来模拟2阶段提交时使用像MongoDB这样的东西,其中每个操作都是原子的,并且不支持除此之外的事务?
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或其他任何来自命令处理程序infrastucture的外部事务范围。从我所看到的,我们应该接近2pc的相同语义 - 但我觉得我错过了一些东西。