NATS Chinese document: Serial Number

A common problem is that many messages due to network failure, the message may be lost or discarded. A simple model to address this situation is to include in the message sequence id. The recipient can check the sequence id to see if anything is missing. In the absence of new data, the sequence number in conjunction with a heartbeat signal, the formation of a strong and flexible model to detect missing. Storage and persistent messaging systems can solve this problem, the problem at hand but will sometimes cause too much damage, and often lead to additional administrative and operating costs.

To truly take advantage of sequence id, keep in mind the following points:

  • Each sender must use their own sequence
  • If possible, the receiver should be able to request the missing information by id

Use NATS, you can embedding sequence id in the message or they may contain as a token in the subject. For example, the sender may send a message to the updates.1, updates.2 like. Subscribers can monitor the update. * And parse theme to determine the sequence id. If the load is unknown or not additional data is embedded in the load serial number, etc., you may need to be placed into the token sequence of the subject.

Published 19 original articles · won praise 2 · Views 670

Guess you like

Origin blog.csdn.net/weixin_43465618/article/details/105115702