The final solution based on the message consistency

Consideration about

Orders systems integration and systems, financial accounting systems in different systems, the successful integration of financial systems or operating system if the order is no corresponding record, it will cause data inconsistencies, in this context we would need to have a solution to inconsistency.
Program is shown below (Figure dragon fruit scheme School):
     
 
 
In this case only listed a distributed transaction between the two systems can be understood as a simple ordering system and billing system

FIG example explains

  1.   Blue dashed block: Transaction initiating party, the origin of the entire process can be understood in order for the user to pay part of the system
  2.   Purple of the dashed blocks: Subsystem service message, the message is stored in the database, to ensure the reliability of the message
  3.   Green dashed block: the transaction is the caller may be billed understanding of the payment operations for the billing system  
  4.   Confirmation message status subsystem: confirmation message was successfully consumption, if not successful consumer compensation as the need to resend
  5.   Message recovery subsystem: subsystem message service message after repeatedly sending still not been "passive put applications" to confirm the consumer is required to hang message recovery subsystem task is to make the "Message Services Subsystem" message reactivate and send to ensure that this message is "passive party applications' re on the line can consume

Call flow and fault tolerance

Normal process: 1 pre-acknowledgment message and transmits 2dubbo return 3 4 5 sends a message listener receiving a message 6ACK 7 acknowledgment in the acknowledgment has been received the transaction has been successfully processed;
Abnormal process:
  1.   If 1 or 2 fails, the entire transaction fails
  2.   If 3 fails, the data preprocessing "Subsystem Status message" scanning "Message Services Subsystem" stored in the table, and the reverse lookup "active application", if the "active application" queried order status that has been processed, it is called "news service subsystem," the message states stored modified to be sent consumer interface and call "message service subsystem" to send a message interface.
  3.   If 4 fails, means "the passive side applications" can not consume messages, then there must not be executed 7, then you need "message recovery subsystem" periodic inspection "Message Services Subsystem" in the unconfirmed message has expired, by "message recovery subsystem" re-sent, if the message has been sent and the normal processes go, it will be processed and consumed 7 confirmed
  4.   If 5 fails, and c as abnormal processes, the "recovery subsystem message" Processing
  5.   If the failure 6, and 7 has been successfully validated, the message will be repeated this entry consumption, then it reflects the importance idempotent, when the "passive party applications" such as power consumption information processing needs to be done to avoid duplication operation
  6.   If 7 fails, the impact at this time is the "passive party applications' success and consumption process is successful, but no notification to" Message Services Subsystem ", then when the" message recovery subsystem "subsystem resend the message needs to be done powers and other treatment, and re-take the 7 processes;

expand

  •  FIG purple part of the message service subsystem, subsystem acknowledgment message, message-restoration into three sub-systems arranged to decouple
  •  Message includes a message storage service subsystem and a message transmission function, mainly in the ability to provide, as a public service
  •  Message acknowledgment and message recovery subsystem subsystem is closely related to the business, depending on whether the message needs to query specific business process is successful, so independent
  •  In reality little traffic, the message confirmation service by way of the module is integrated into the business system calls, message recovery subsystem integrated into the message subsystem, which only need to deploy a service to
  •  Message services subsystem may be used to enhance the performance of distributed lock redis (repeated operation)

to sum up

  • Distributed power in affairs of judgment is very important
  • Network is unreliable, any process are likely to fail, requiring multiple failure compensation strategies
  • Compared with the DAO, distributed transaction-based; the advantage of high controllability and visualization, decouple code, load shifting; only drawback is that for notifying transaction type, lack of timeliness, large code amount, the code has invaded .
      

Guess you like

Origin www.cnblogs.com/xieyanke/p/12143403.html