Local transaction ACID we should all know, unified commit, failure rollback, strictly ensure the consistency of data within the same transaction! Distributed transactions do not implement this ACID, which can only implement two of the CAP principles, a widely used prototype for distributed transactions. CAP(Consistency, Availability, Partition Tolerance) elaborates three main aspects of a distributed system, which can only be realized by choosing two at the same time. Common CP system, AP system.

Several frameworks have emerged in the industry for the principles applied to CP and AP:

CP system has two-phase commit (strong consistency)

AP systems have TCC(compensated transaction)

Aspnetcore-cap is an asynchronous messaging solution that meets the ultimate consistency. It provides a solution for mysql and sqlserver. The message queue can be kafka or rabbitmq. The source code is open source on Github, and the package is available on Nuget!

Understanding of message-assured – ultimate consistency distributed transactions:

    1. Service A submits data
    1. Sends a message to the message center
    1. The message center pushes messages to subscribers
    1. Subscribers handle their own business logic
    1. Failure to repeatedly retry until success, rather than strong consistency, roll back A