Message synchronization method and device

By using message sequence identification for checksum processing during message synchronization, the sequence problem of message transmission in three-party system docking is solved, and the synchronization efficiency and accuracy of message data are improved.

CN118900272APending Publication Date: 2024-11-05BEIJING JINGDONG TUOXIAN TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411269822.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-11
Publication Date
2024-11-05

AI Technical Summary

Technical Problem

In the existing three-party system docking scheme, there are problems of message transmission loss and out of order, which affects the accuracy and efficiency of message reception.

Method used

By determining the target message type based on the target user identity and preset mapping relationship, obtaining the message sequence identification, and adding it to the message to be synchronized, and verifying the message sending order to ensure the order of message transmission.

Benefits of technology

It effectively avoids out-of-order and loss of messages, and improves the efficiency and accuracy of message data synchronization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118900272A_ABST
    Figure CN118900272A_ABST
Patent Text Reader

Abstract

The invention discloses a message synchronization method and device, and relates to the technical field of computers. A specific embodiment of the method comprises the steps of determining a target message type according to a target user identifier and a preset mapping relationship, performing message filtering based on the target message type to obtain a to-be-synchronized message, adding an obtained message sequence identifier to the to-be-synchronized message, performing sending sequence verification, and sending the to-be-synchronized message to the target user identifier. And sending the message passing the verification to the target user for data synchronization processing. According to the embodiment, the sequence in the message transmission process can be ensured, and message disorder is avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a message synchronization method and device. Background Art

[0002] With the development of Internet business, there is often a certain degree of interaction between the business systems of various enterprises. Through the message data of the interaction between systems, more abundant business processing can be achieved. For example, in the health check scenario, when the enterprise health business is segmented in the team physical examination, it is necessary to synchronize the appointment status, attendance status, report generation status, etc. of the physical examinee with the external third-party system.

[0003] The current three-party system docking solutions on the market mainly use traditional message queues and other methods as solutions. The entire process is roughly: message construction, message sending, and three-party receiving. There are certain problems in the reliability of the system, such as the possibility of message loss. If lost, manual intervention is required, which is inefficient. In addition, the three-party system generally requires strong sequentiality in message sending. If it is out of order, it may affect the accuracy of message reception. Summary of the invention

[0004] In view of this, an embodiment of the present invention provides a method and apparatus for message synchronization, which can ensure the order of message synchronization processing and avoid disorder in message transmission.

[0005] To achieve the above object, according to one aspect of an embodiment of the present invention, a message synchronization method is provided, comprising:

[0006] Determine the target message type according to the target user identifier and the preset mapping relationship, where the preset mapping relationship is the correspondence between the preset user identifier and the message type;

[0007] Filter the acquired user messages based on the target message type to obtain the messages to be synchronized;

[0008] For each message to be synchronized, a message sequence identifier of the message to be synchronized is obtained, and the message sequence identifier is added to the message to be synchronized, where the message sequence identifier of the message to be synchronized is generated according to the receiving order of the message to be synchronized;

[0009] The message sending sequence is verified according to the message sequence identifier of each message to be synchronized, and the messages to be synchronized that pass the verification are sent to the target user for synchronization processing.

[0010] Optionally, after the message sequence identifier is added to the message to be synchronized, the following is further included:

[0011] Send the message to be synchronized to the message middleware and store the message to be synchronized in the message middleware;

[0012] And, performing message sending sequence verification according to the message sequence identifier of each message to be synchronized, including:

[0013] According to the message sequence identifier of each message to be synchronized, the message sending sequence of the messages to be synchronized stored in the message middleware is verified.

[0014] Optionally, the method further comprises:

[0015] In response to failure in sending the to-be-synchronized message, resending the to-be-synchronized message.

[0016] Optionally, performing message sending sequence verification according to the message sequence identifier of each message to be synchronized, and sending the verified messages to be synchronized to the target user for synchronization processing, includes:

[0017] Based on the message sending identifier, the target message to be synchronized is queried according to the message sequence identifier of the message to be synchronized in the message middleware. The message sending identifier is determined based on the message sequence identifier of the sent message.

[0018] In response to finding a target message to be synchronized whose message sequence identifier is consistent with the message sending identifier, the target message to be synchronized is treated as a verified message to be synchronized and sent to a target user for synchronization processing.

[0019] Optionally, the method further comprises:

[0020] In response to failure to find a target to-be-synchronized message whose message sequence identifier is consistent with the message sending identifier, the target user identifier is added to a blacklist.

[0021] Optionally, the method further comprises:

[0022] In response to failure to obtain the message sequence identifier of the message to be synchronized, the target user identifier is added to a blacklist.

[0023] Optionally, before determining the target message type according to the target user identifier and the preset mapping relationship, the method further includes:

[0024] Make sure that the target user ID is not included in the blacklist.

[0025] According to another aspect of an embodiment of the present invention, a message synchronization device is provided, including:

[0026] A determination module, used to determine a target message type according to a target user identifier and a preset mapping relationship, where the preset mapping relationship is a correspondence between a preset user identifier and a message type;

[0027] A filtering module is used to filter the acquired user messages based on the target message type to obtain the messages to be synchronized;

[0028] An acquisition module is used to acquire a message sequence identifier of each message to be synchronized, and add the message sequence identifier to the message to be synchronized, wherein the message sequence identifier of the message to be synchronized is generated according to the receiving order of the message to be synchronized;

[0029] The synchronization module is used to verify the message sending sequence according to the message sequence identifier of each message to be synchronized, and send the verified messages to be synchronized to the target user for synchronization processing.

[0030] According to another aspect of an embodiment of the present invention, an electronic device is provided, comprising: one or more processors; a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the message synchronization method provided by an embodiment of the present invention.

[0031] According to another aspect of an embodiment of the present invention, a computer-readable medium is provided, on which a computer program is stored. When the program is executed by a processor, the message synchronization method provided by an embodiment of the present invention is implemented.

[0032] According to another aspect of an embodiment of the present invention, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, the message synchronization method provided by an embodiment of the present invention is implemented.

[0033] An embodiment of the above invention has the following advantages or beneficial effects: it is capable of determining the target message type corresponding to the target user identifier according to a preset mapping relationship, and filtering the user messages based on the target message type to obtain the messages to be synchronized, obtaining the message sequence identifier and adding it to the messages to be synchronized, and performing message sending sequence verification on the messages to be synchronized, and sending the verified messages to the target user for synchronization processing. The added message sequence identifier can ensure the sequence of message transmission, avoid message disorder and loss, and improve the efficiency and accuracy of message data synchronization.

[0034] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with specific implementation examples. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.

[0036] Figure 1 is a schematic diagram of main steps of a method for message synchronization according to an embodiment of the present invention;

[0037] Figure 2 It is a data interaction diagram of the message synchronization method provided by the present invention;

[0038] Figure 3It is a system flow chart of the message synchronization method provided by the present invention;

[0039] Figure 4 is a schematic diagram of main modules of a device for message synchronization according to an embodiment of the present invention;

[0040] Figure 5 is an exemplary system architecture diagram to which embodiments of the present invention may be applied;

[0041] Figure 6 It is a schematic diagram of the structure of a computer system of a terminal device or a server suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION

[0042] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.

[0043] It should be noted that the collection, collection, updating, analysis, processing, use, transmission, storage and other aspects of user personal information involved in the technical solution disclosed in the present invention are in compliance with the provisions of relevant laws and regulations, are used for legitimate purposes, and do not violate public order and good morals. Necessary measures are taken for user personal information to prevent illegal access to user personal information data and maintain the security of user personal information, network security and national security.

[0044] It should be noted that in the technical solution of the present invention, the collection, use, storage, sharing and transfer of user personal information involved are in compliance with the provisions of relevant laws and regulations, and it is necessary to inform the user and obtain the user's consent or authorization. When applicable, the user's personal information is de-identified and / or anonymized and / or encrypted.

[0045] Figure 1 is a schematic diagram of the main process of the method for accessing a page according to an embodiment of the present invention, such as Figure 1 As shown, including:

[0046] Step S101, determining a target message type according to a target user identifier and a preset mapping relationship, where the preset mapping relationship is a correspondence relationship between a preset user identifier and a message type.

[0047] When determining the message that needs to be synchronized to the target third-party system, it is necessary to obtain the target user identifier of the target third-party system and the pre-stored preset mapping relationship. According to the preset mapping relationship, the target message type that needs to be received and synchronized corresponding to the target user identifier can be determined. Among them, the preset mapping relationship is the correspondence between the preset user identifier and the message type, that is, the mapping relationship that characterizes the message type that the three-party system needs to receive; the preset mapping relationship can be determined based on the user identifier-based message type input / configured by the user through the visual interface, or it can be determined based on the received user identifier and the configuration information of the message type. In the redis (a database) cache scenario, the preset mapping relationship is stored in the form of key-value pairs, for example, key (primary key): enterprise id; value (value): new product channel (true), channel price change (true). Among them, true means that the user has selected this message type in the visual interface.

[0048] Step S102: Filter the acquired user messages based on the target message type to obtain messages to be synchronized.

[0049] After determining the target message type that needs to be synchronized with the target third-party system, filter the received messages according to the type to obtain the message type to be synchronized. Among them, the user message is a message constructed by the business system and needs to be synchronized to the target third-party system; after receiving the user message, it needs to be persistently stored, for example, log recording, specifically recording a message record in the sending log table in the local database of the application system.

[0050] Optionally, user messages sent by the business system are received through a Smart client and persistently stored. The Smart client also needs to determine whether user messages need to be synchronized based on a preset mapping relationship. This operation can be performed before or after the persistent storage operation. In determining whether message synchronization is required, the type of user message received can be first determined to determine whether there is a system in a normal state in at least one of the three-party systems corresponding to the user message type. If so, synchronization is required. If not, synchronization is not required. The normal state refers to a state that is not on the blacklist and is not marked as abnormal.

[0051] Step S103: for each message to be synchronized, obtain a message sequence identifier of the message to be synchronized, and add the message sequence identifier to the message to be synchronized. The message sequence identifier of the message to be synchronized is generated according to the receiving order of the message to be synchronized.

[0052] After determining the messages to be synchronized, an identifier needs to be added to ensure the order of the messages. Specifically, the message order identifier is obtained according to the order in which the messages to be synchronized are received, and the message order identifier is added to the message.

[0053] Optionally, the message sequence identifier can be generated by the BID (business identifier) ​​system. Specifically, when an identifier request based on a message to be synchronized is obtained, the latest user identifier that has been generated is determined according to the message type of the message to be synchronized in the request and the corresponding target user identifier, and the message sequence identifier of this time is generated based on the identifier. Take the generation process of the message sequence identifier of the BID system as an example. A BID identifier is 2401001096, where 2401 is the user identifier, 001 is the number of the message type, and 096 is the sequence number of the message type under the user identifier. After obtaining a message to be synchronized, a message sequence identifier request containing the message type and user identifier is sent to the BID system; the BID system determines the last generated BID identifier based on the message type and user identifier, for example, the last identifier is 2401001096, and the message sequence identifier of this time is generated as 2401001097; the message sequence identifier of this time is added to the message. The message types may be, for example: Type 1: order message (pending payment, paid, canceled, completed); Type 2: physical examination appointment message (pending appointment, appointment in progress, appointment successful, arrived for examination, report issued).

[0054] Optionally, the BID system stores a BID data table, as shown in Table 1, which includes enterpriseld (enterprise id), type (message type) and BID (generated BID) data; the value corresponds to the number of data, such as the number of enterprise identifiers and the number of message types.

[0055]

[0056] Step S104: verify the message sending sequence according to the message sequence identifier of each message to be synchronized, and send the verified messages to be synchronized to the target user for synchronization processing.

[0057] The message sending order is verified according to the message sequence identifier of each message to be synchronized to check whether it is the next message sequence to be synchronized. If so, the verification passes, and the message to be synchronized that passes the verification is sent to the target user for synchronization processing. At this time, the message to be synchronized contains the message sequence identifier, so that the target user can perform synchronization processing according to the message sequence. Among them, the target user can be the target three-party system.

[0058] According to the data synchronization method provided by the embodiment of the present invention, it is possible to determine the target message type corresponding to the target user identifier according to a preset mapping relationship, and filter the user messages based on the target message type to obtain the messages to be synchronized, obtain the message sequence identifier and add it to the messages to be synchronized, and perform message sending order verification on the messages to be synchronized, and send the verified messages to the target user for synchronization processing. The added message sequence identifier can ensure the sequence of message transmission, avoid message disorder and loss, and improve the efficiency and accuracy of message data synchronization.

[0059] Optionally, after adding the message sequence identifier to the message to be synchronized, it also includes: sending the message to be synchronized to the message middleware, and storing the message to be synchronized in the message middleware; and, performing message sending order verification according to the message sequence identifier of each message to be synchronized, including: performing message sending order verification on the messages to be synchronized stored in the message middleware according to the message sequence identifier of each message to be synchronized.

[0060] After adding the message sequence identifier to the message to be synchronized, it is necessary to send the message to be synchronized to the message middleware and store the message to be synchronized in the message middleware. The message middleware can be a message system, which is used to verify the received message and send the message that passes the verification. The object of the message sending sequence verification is the message stored in the message middleware, and it is verified whether the message to be synchronized is the next message in the sending sequence. If the verification passes, the message is sent to the target user for synchronization. If not, the message will not be sent.

[0061] Optionally, the message middleware is a message system, which specifically includes subsystems: a message receiving system and a message sending system. The message receiving system receives the messages to be synchronized with message sequence identifiers sent by the Smart client and stores them in a mysql (relational database management system) library. The message sending system verifies the messages to be synchronized in the message receiving system according to the obtained verification information, pulls the verified messages to be synchronized, and sends them to the target user for synchronization.

[0062] The message sending system stores a message table, as shown in Table 2, including enterpriseld (enterprise id), type (message type), status (specific classification of message type) and body (specific message content).

[0063]

[0064] According to the data synchronization method provided by the embodiment of the present invention, messages can be stored in the message middleware and the message sending order can be verified. By storing messages in the message middleware, the reliability of the messages can be improved, and the sequence of the messages can be guaranteed based on the verification operation.

[0065] Optionally, the method further includes: in response to failure to send the message to be synchronized, resending the message to be synchronized. When sending the message to be synchronized to the message middleware, if the sending fails, that is, the message of successful sending returned by the message middleware is not received, it will try to resend it, and the number of retries or retry time can be preset to determine whether the sending is successful within the preset number of retries or retry time. If the sending fails, a system abnormality mark is generated, and Smart will no longer send the message. The system will be manually checked later, and the mark can be manually eliminated after confirming that there is no abnormality.

[0066] Optionally, the message system also includes a subsystem: a message compensation system. If Smart still fails to send within the preset number of retries or retry time range, it will send the message to be synchronized to the message compensation system and store it in redis. The subsequent message sending system will pull the messages in the message receiving system and the message compensation system, that is, verify the messages in the message receiving system and the message compensation system, and the priority of the message compensation system is higher than that of the message receiving system. Since the message compensation system uses redis as the storage system, it has higher performance and availability than the mysql storage system, which can ensure that the compensation system is the system that is least likely to hang up, and ensure that messages are not lost as much as possible. Among them, if the current message is sent to the message compensation system due to a sending failure, then the next message does not need to be judged when it is sent, and can be sent directly to the compensation system until the preset time length is reached. For example, messages are sent to the message compensation system within 10 minutes, and messages are retried to be sent to the message receiving system after 10 minutes. Alternatively, if the current message is sent to the message compensation system due to a sending failure, then the next message still needs to go through the same retry process, that is, to determine whether it is sent successfully within the preset number of retries or retry time range.

[0067] According to the data synchronization method provided in an embodiment of the present invention, the message compensation system can compensate for the failed messages sent to the message receiving system and store them, thereby avoiding the loss of messages, improving the reliability of messages, and helping to improve the accuracy of subsequent message verification.

[0068] Optionally, the message sending sequence is verified according to the message sequence identifier of each message to be synchronized, and the verified messages to be synchronized are sent to the target user for synchronization processing, including: based on the message sending identifier, querying the target message to be synchronized according to the message sequence identifier of the message to be synchronized in the message middleware, and the message sending identifier is determined based on the message sequence identifier of the sent message; in response to the query of the target message to be synchronized whose message sequence identifier is consistent with the message sending identifier, the target message to be synchronized is regarded as a verified message to be synchronized and sent to the target user for synchronization processing. When verifying the message sending sequence, first obtain the message sending identifier, which is the sequence identifier of the next message to be sent, and can be determined according to the sequence identifier of the sent message. Verify whether there is a consistent message sequence identifier in the message receiving system and the message compensation system according to the message sending identifier. If so, pull the message corresponding to the message sequence identifier and send it to the target user. If not, the message pulling operation will not be performed.

[0069] Optionally, the message sending identifier is generated by the BID system, and according to the identifier request including the target user identifier and the message type sent by the message sending system, the next message sequence identifier to be sent based on the target user identifier and the message type is generated, that is, the sequence + 1 is added to the message sequence identifier determined based on the target user identifier and the message type. Specifically, the message sending system stores a consumption site table, which stores the consumed sites, that is, the message sequence identifiers that have been sent. According to the site table, the last successfully sent consumption site, that is, the latest message sequence identifier that has been sent, can be obtained.

[0070] Optionally, the message sending system obtains the sending item by traversing the whitelist, that is, the target user identifier and the corresponding target message type that need to be synchronized, obtains the last successfully sent consumption location from the consumption location table (Table 3) according to the obtained sending item, and then sends a request to the BID system based on the consumption location. The whitelist is a shard allocation controller stored in the BID system that pre-configures the user identifier and the corresponding message type that need to be synchronized.

[0071]

[0072] According to the data synchronization method provided by the embodiment of the present invention, a message sequence identifier can be generated by the BID system and added to the message in the order in which the messages are received, thereby ensuring the order of the messages. The subsequent message sending system verifies the message to be synchronized according to the message sending identifier generated by the BID system, and sends the message only after the verification is passed, thereby avoiding the impact caused by disordered message reception and ensuring the order of the messages.

[0073] Optionally, the method further includes: in response to not finding the target message to be synchronized whose message sequence identifier is consistent with the message sending identifier, adding the target user identifier to a blacklist. If the message sequence identifier consistent with the message sending identifier is not found during the verification process, the message may be lost, and the target user identifier is added to the blacklist.

[0074] Optionally, the target user identifier+target message type is added to the blacklist, that is, only the message of the target message type of the target user identifier will not be sent, and other types of messages of the target user identifier will still be sent.

[0075] Optionally, the method further includes: in response to failure to obtain the message sequence identifier of the message to be synchronized, adding the target user identifier to a blacklist. If the BID system fails to return the message sequence identifier of the message to be synchronized, it means that the message to be synchronized is not a message type or user that needs to be synchronized, and the target user identifier of the message to be synchronized is added to the blacklist for subsequent manual processing.

[0076] Optionally, before determining the target message type according to the target user identifier and the preset mapping relationship, the method further includes: determining that the target user identifier is not included in the blacklist. Before determining the target message type, it is first necessary to determine that the target user identifier is not in the blacklist, otherwise synchronization processing will not be performed.

[0077] Optionally, when the message sending system sends a message to the target user, that is, the third-party system, if the sending timeout occurs, a retry operation will be performed. If the message is still not sent successfully after reaching the preset retry number threshold, the target user ID + target message category will be suspended. The suspension will be cancelled and the message will be sent again after subsequent manual processing.

[0078] According to the message synchronization method provided by the embodiment of the present invention, it is possible to determine the target message type corresponding to the target user identifier according to a preset mapping relationship, and filter the user messages based on the target message type to obtain the target user's messages to be synchronized, obtain the message sequence identifier from the BID system and add it to the messages to be synchronized, and perform message sending sequence verification on the messages to be synchronized, and send the verified messages to the target user for synchronization processing, which greatly improves the reliability and sequence of the message transmission process, avoids message disorder, and improves the message synchronization efficiency.

[0079] like Figure 2The figure shows a data interaction diagram of a message synchronization method, including a business system, a Smart client, a message receiving system, a message compensation system, a BID system, a message sending system, and a third-party external system. First, the Smart client obtains the build message sent by the business system, obtains the persistent message by recording the log, and queries the mapping by matching the mapping data through the message sending to determine whether the message needs to be synchronized. The BID of the message to be synchronized is obtained from the BID system and added to the message. The added message is delivered to the message receiving system. If it fails, a compensation message is sent to the message compensation system, and then the message receiving system pulls the compensation message to obtain a complete message. The message sending system obtains the verification message from the BID system, pulls the message of the message receiving system according to the verification message, and sends it to the third-party external system.

[0080] like Figure 3 The figure shows a system flow chart of a message synchronization method. Users can perform manual operations through the user message management system, select the push message type - set the push message address - persist data to the enterprise tenant information table; view the message push list - query the ES message table; re-push the message - send the message to the third-party system; suspend / start the enterprise - modify the enterprise tenant information table status. The business system produces a message and calls the Smart client to send the message. After sending it to the Smart client, it determines whether the message needs to be sent according to the message sending configuration mapping. If so, it is written locally. And judge whether the system is abnormal. If it is abnormal, the sending is terminated and the system alarms; if it is not abnormal, the BID is obtained from the BID system. If the acquisition is successful, the BID is added to the message and sent. If the acquisition fails, the user identifier-message type is marked as suspended, the sending is terminated, and the system alarms. Among them, after the BID system generates the BID, the BID needs to be recorded. Determine whether the message is successfully sent to the message receiving system. If not, send a compensation message to the message compensation system and record the compensation information. After sending to the message receiving system, the message receiving system receives the message, pulls the compensation message, and records the obtained message into the message table. The message sending system obtains the whitelist through the BID shard allocation controller, and obtains the sending item by traversing the whitelist. Among them, the BID system obtains nextBID according to the generated BID and stores it in the nextBID interface. Determine whether the sending item is blacklisted or suspended. If so, skip the sending item. Otherwise, obtain the sent point of the user ID-message type, and obtain nextBID through the nextBID interface. Determine whether there is a corresponding message for nextBID. If not, add the user ID-message type to the blacklist. The blacklist can be preset for a time period. If the time period is exceeded, it will be automatically released from the blacklist. If it exists, send the message to the three-party system. If the sending is successful, record the message BID and modify the message table; otherwise, suspend the tenant, that is, the user.

[0081] Figure 4 4 is a schematic diagram of a message synchronization device 400 provided in an embodiment of the present invention, such as Figure 4 As shown, including:

[0082] The determination module 401 is used to determine the target message type according to the target user identifier and the preset mapping relationship, where the preset mapping relationship is the correspondence between the preset user identifier and the message type;

[0083] A filtering module 402 is used to filter the acquired user messages based on the target message type to obtain the messages to be synchronized;

[0084] The acquisition module 403 is used to acquire a message sequence identifier of each message to be synchronized, and add the message sequence identifier to the message to be synchronized, wherein the message sequence identifier of the message to be synchronized is generated according to the receiving order of the message to be synchronized;

[0085] The synchronization module 404 is used to verify the message sending sequence according to the message sequence identifier of each message to be synchronized, and send the verified messages to be synchronized to the target user for synchronization processing.

[0086] The message synchronization device provided according to the embodiment of the present invention can determine the target message type corresponding to the target user identifier according to a preset mapping relationship, and filter the user messages based on the target message type to obtain the messages to be synchronized, obtain the message sequence identifier to add to the messages to be synchronized, and perform message sending sequence verification on the messages to be synchronized, and send the verified messages to the target user for synchronization processing. The added message sequence identifier can ensure the sequence of message transmission, avoid message disorder and loss, and improve the efficiency and accuracy of message data synchronization.

[0087] Optionally, the device also includes: a storage module 405 (not shown in the figure), which is used to send messages to be synchronized to the message middleware and store the messages to be synchronized in the message middleware; a synchronization module 404, which is also used to verify the message sending order of the messages to be synchronized stored in the message middleware according to the message sequence identifier of each message to be synchronized.

[0088] Optionally, the device further includes: a sending module 406 (not shown in the figure), configured to resend the message to be synchronized in response to failure in sending the message to be synchronized.

[0089] Optionally, the synchronization module 404 is also used to: based on the message sending identifier, query the target message to be synchronized according to the message sequence identifier of the message to be synchronized in the message middleware, and the message sending identifier is determined based on the message sequence identifier of the sent message; in response to querying the target message to be synchronized whose message sequence identifier is consistent with the message sending identifier, treat the target message to be synchronized as a verified message to be synchronized and send it to the target user for synchronization processing.

[0090] Optionally, the device further includes: an adding module 407 (not shown in the figure), configured to add the target user identifier to a blacklist in response to failure to find a target message to be synchronized whose message sequence identifier is consistent with the message sending identifier.

[0091] Optionally, the device further includes: an adding module 407 (not shown in the figure), which is further configured to add the target user identifier to a blacklist in response to failure to obtain the message sequence identifier of the message to be synchronized.

[0092] Optionally, the device further includes: a determination module 401, further configured to determine that the blacklist does not include the target user identifier.

[0093] The message synchronization device provided according to the embodiment of the present invention can determine the target message type corresponding to the target user identifier according to a preset mapping relationship, and filter the user messages based on the target message type to obtain the messages to be synchronized, obtain the message sequence identifier to add to the messages to be synchronized, and perform message sending sequence verification on the messages to be synchronized, and send the verified messages to the target user for synchronization processing. The added message sequence identifier can ensure the sequence of message transmission, avoid message disorder and loss, and improve the efficiency and accuracy of message data synchronization.

[0094] Figure 5 An exemplary system architecture 500 is shown to which the message synchronization method or message synchronization apparatus according to an embodiment of the present invention may be applied.

[0095] like Figure 5 As shown, system architecture 500 may include terminal devices 501, 502, 503, a network 504 and a server 505. Network 504 is used to provide a medium for communication links between terminal devices 501, 502, 503 and server 505. Network 504 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.

[0096] Users can use terminal devices 501, 502, 503 to interact with server 505 through network 504 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 501, 502, 503, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only for example).

[0097] The terminal devices 501 , 502 , and 503 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, and the like.

[0098] The server 505 may be a server that provides various services, such as a background management server (only for example) that provides support for shopping websites browsed by users using the terminal devices 501, 502, and 503. The background management server may analyze and process the received message synchronization request and other data, and feed back the processing results (such as messages to be synchronized - only for example) to the terminal device.

[0099] It should be noted that the message synchronization method provided in the embodiment of the present invention is generally executed by the server 505 , and accordingly, the message synchronization device is generally set in the server 505 .

[0100] It should be understood that Figure 5 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.

[0101] Reference below Figure 6 , which shows a schematic diagram of the structure of a computer system 600 of a terminal device or a server suitable for implementing an embodiment of the present invention. Figure 6 The terminal device or server shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0102] like Figure 6 As shown, the computer system 600 includes a central processing unit (CPU) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage part 608 into a random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the system 600 are also stored. The CPU 601, the ROM 602, and the RAM 603 are connected to each other through a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.

[0103] The following components are connected to the I / O interface 605: an input section 606 including a keyboard, a mouse, etc.; an output section 607 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 608 including a hard disk, etc.; and a communication section 609 including a network interface card such as a LAN card, a modem, etc. The communication section 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to the I / O interface 605 as needed. A removable medium 611, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 610 as needed, so that a computer program read therefrom is installed into the storage section 608 as needed.

[0104] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 609, and / or installed from the removable medium 611. When the computer program is executed by the central processing unit (CPU) 601, the above-mentioned functions defined in the system of the present invention are executed.

[0105] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.

[0106] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0107] The units or modules involved in the embodiments of the present invention may be implemented in software or hardware. The units or modules described may also be provided in a processor, for example, may be described as: a processor including a determination module, a filtering module, an acquisition module and a synchronization module. The names of these units or modules do not, in certain cases, constitute limitations on the units or modules themselves, for example, the determination module may also be described as "a module for determining a target message type based on a target user identifier and a preset mapping relationship".

[0108] As another aspect, the present invention further provides a computer-readable medium, which may be included in the device described in the above embodiment; or may exist independently without being assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device includes:

[0109] Determine the target message type according to the target user identifier and the preset mapping relationship, where the preset mapping relationship is the correspondence between the preset user identifier and the message type;

[0110] Filter the acquired user messages based on the target message type to obtain the messages to be synchronized;

[0111] For each message to be synchronized, a message sequence identifier of the message to be synchronized is obtained, and the message sequence identifier is added to the message to be synchronized, where the message sequence identifier of the message to be synchronized is generated according to the receiving order of the message to be synchronized;

[0112] The message sending sequence is verified according to the message sequence identifier of each message to be synchronized, and the messages to be synchronized that pass the verification are sent to the target user for synchronization processing.

[0113] According to the technical solution of the embodiment of the present invention, the target message type corresponding to the target user identifier can be determined according to the preset mapping relationship, and the user messages can be filtered based on the target message type to obtain the messages to be synchronized, and the message sequence identifier can be obtained and added to the messages to be synchronized, and the message sending order of the messages to be synchronized can be verified, and the verified messages can be sent to the target user for synchronization processing. The added message sequence identifier can ensure the sequence of message transmission, avoid message disorder and loss, and improve the efficiency and accuracy of message data synchronization.

[0114] As another aspect, the present invention further provides a computer program product, including a computer program, which implements the method of the embodiment of the present invention when the computer program is executed by a processor.

[0115] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A message synchronization method, characterized in that: include: Determine the target message type according to the target user identifier and a preset mapping relationship, wherein the preset mapping relationship is a correspondence between a preset user identifier and a message type; Filter the acquired user messages based on the target message type to obtain messages to be synchronized; For each message to be synchronized, obtaining a message sequence identifier of the message to be synchronized, and adding the message sequence identifier to the message to be synchronized, wherein the message sequence identifier of the message to be synchronized is generated according to the receiving order of the message to be synchronized; The message sending sequence is verified according to the message sequence identifier of each message to be synchronized, and the messages to be synchronized that pass the verification are sent to the target user for synchronization processing.

2. The method according to claim 1, characterized in that After the message sequence identifier is added to the message to be synchronized, the method further includes: Sending the message to be synchronized to the message middleware, and storing the message to be synchronized in the message middleware; And, performing message sending sequence verification according to the message sequence identifier of each message to be synchronized includes: According to the message sequence identifier of each message to be synchronized, the message sending sequence of the messages to be synchronized stored in the message middleware is verified.

3. The method according to claim 2, characterized in that The method further comprises: In response to failure in sending the message to be synchronized, resending the message to be synchronized.

4. The method according to claim 1, characterized in that The message sending sequence verification is performed according to the message sequence identifier of each message to be synchronized, and the verified messages to be synchronized are sent to the target user for synchronization processing, including: Based on the message sending identifier, querying the target message to be synchronized according to the message sequence identifier of the message to be synchronized in the message middleware, wherein the message sending identifier is determined based on the message sequence identifier of the sent message; In response to finding a target message to be synchronized whose message sequence identifier is consistent with the message sending identifier, the target message to be synchronized is taken as a verified message to be synchronized and sent to a target user for synchronization processing.

5. The method according to claim 4, characterized in that The method further comprises: In response to not finding a target to-be-synchronized message whose message sequence identifier is consistent with the message sending identifier, the target user identifier is added to a blacklist.

6. The method according to claim 1, characterized in that The method further comprises: In response to failure to obtain the message sequence identifier of the message to be synchronized, adding the target user identifier to a blacklist.

7. The method according to claim 1, 5 or 6, characterized in that: Before determining the target message type according to the target user identifier and the preset mapping relationship, the method further includes: It is determined that the target user identifier is not included in the blacklist.

8. A message synchronization device, characterized in that: include: A determination module, used to determine a target message type according to a target user identifier and a preset mapping relationship, wherein the preset mapping relationship is a correspondence between a preset user identifier and a message type; A filtering module, used to filter the acquired user messages based on the target message type to obtain the messages to be synchronized; An acquisition module, used for acquiring a message sequence identifier of each message to be synchronized, and adding the message sequence identifier to the message to be synchronized, wherein the message sequence identifier of the message to be synchronized is generated according to the receiving order of the message to be synchronized; The synchronization module is used to verify the message sending sequence according to the message sequence identifier of each message to be synchronized, and send the verified messages to be synchronized to the target user for synchronization processing.

9. An electronic device, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 7.

10. A computer readable medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.

11. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.