Best-effort delivery is the simplest kind of flexible transaction, which is suitable for some services with low final consistency time sensitivity, and the processing result of the passive party does not affect the processing result of the active party. Typical usage scenarios: bank notification, merchant notification, etc.

Best effort notice

Best-effort delivery is the simplest kind of flexible transaction, which is suitable for some services with low final consistency time sensitivity, and the processing result of the passive party does not affect the processing result of the active party. Typical usage scenarios: bank notification, merchant notification, etc. The implementation scheme of maximum effort notification generally conforms to the following characteristics:

  1. Unreliable message: The business activity active party, after completing the business process, sends a message to the passive party of the business activity until it is notified N times, allowing the message to be lost (unreliable message).
  2. Periodic proofreading: The passive side of a business activity queries the active side of a business activity (the active side provides the query interface) to recover lost business messages according to a scheduled policy.

Maximum effort notification example

For example, the author once built a short message sending platform. The background is that there are multiple businesses in the company that need to send short messages. If each business implements the short message sending function independently, there will be duplication in function implementation. Therefore, an SMS platform project is specially made, and all business parties can access this SMS platform to realize the function of sending SMS. The simplified architecture is shown below:

SMS Sending Process

The process for a service provider to send an SMS message is as follows:

  1. The service party submits the SMS sending request to the SMS platform.
  2. The SMS platform receives the message to be sent, records it in the database, and marks its status as “received”.
  3. The SMS platform invokes the interface of an external SMS provider to send SMS messages. The external vendor’s interface also asynchronously sends SMS messages to the user’s phone, so when this interface is called, it immediately returns and goes to Step 4.
  4. Changed the SMS sending status to “Sent”.
  5. The sending vendor asynchronously notifies the SMS platform of the result of sending short messages. Notification may fail, so at most N notifications will be made. ;
  6. After receiving the SMS sending result, the SMS platform updates the SMS sending status. The status may be successful or failure (for example, the mobile phone fails to pay the bill). Success or failure is not important, the important thing is that we know the end result of the message sent;
  7. If the notification fails, the platform will not know whether the message was successfully sent or not. Therefore, the SMS sending provider needs to provide a query interface to facilitate the query driven by the SMS platform and conduct regular proofreading.

In this case, the process of the SMS sending provider notifying the SMS platform of the SMS sending result is the most typical maximum-effort notification scheme, which will no longer be notified after being notified for N times. By providing an SMS result query interface, the SMS platform can carry out regular proofreading. Because the time sensitivity of SMS sending service is not high, this scheme is suitable.

Note that the SMS result query interface is very important and must be proofread regularly. Due to the later reconciliation, when the author was doing this project, the total number of short messages sent in a month could reach about 100 million in the peak period. Even if a short message cost only 5 cents, it would be 500 million in a month.

Reference documentation

Flexible transactions: maximum effort notification

This article was first published to wechat public account, all rights reserved, reprint prohibited!