A message push processing method, device, electronic device and storage medium
By maintaining the event version number for message producers and subscribers in a distributed system, determining the message timing is solved, and the timing problem in message push processing is realized, and the automatic processing of events in business logical order is achieved, reducing manual intervention.
Patent Information
- Application Number
- CN202110639629.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-06-08
- Publication Date
- 2024-11-12
- Estimated Expiration
- 2041-06-08
AI Technical Summary
The existing message push processing methods are difficult to ensure the timing of messages in distributed systems, resulting in event execution exceptions, which usually require manual intervention.
By maintaining the event version number separately in the message producer and subscriber, determining the timing of the message based on the difference in the event version number, ensuring that the messages are processed in the correct order, including obtaining the event version number carried by the message and the reference version number of the local record. , confirm the latest information and execute events in a timely manner.
It effectively solves the problem of message timing abnormality, ensures that events are processed in business logical order, reduces manual intervention, and improves the system's automated processing capabilities.
Smart Images

Figure CN113472856B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a message push processing method, device, electronic device and storage medium. Background Art
[0002] The message transmission method of the message bus in the related technology can only solve the problem of message loss and non-duplication (message idempotence). However, the design to solve the message idempotence cannot guarantee the timing of messages in the distributed system. For messages published by publishers, some messages may be related to the time sequence of business logic. For the subscribers of the message, the message can only be effectively processed when the time sequence of the received message is consistent with the time sequence of the business occurrence, otherwise business logic exceptions are prone to occur.
[0003] Due to the distributed systems, asynchronous processing design, network delays, business logic and other issues in the current Internet's high-concurrency scenario, it is difficult to ensure the timing of messages. When the timing of messages is abnormal, it is easy to cause abnormal execution of the events corresponding to the messages, which usually requires manual intervention to process data and repair them manually. Summary of the invention
[0004] The embodiments of the present invention provide a message push processing method, device, electronic device and storage medium to solve the problem that the existing message push processing method easily leads to message timing abnormality, thereby leading to event execution abnormality.
[0005] In order to solve the above-mentioned technical problems, the present invention is achieved as follows:
[0006] In a first aspect, an embodiment of the present invention provides a message push processing method, including:
[0007] In response to receiving the message, obtaining an event version number carried by the message, and comparing it with a first reference version number recorded locally, wherein the event version number carried by the message is determined by the message sender device according to a triggering order of an event corresponding to the message;
[0008] If the difference between the event version number carried by the message and the first reference version number is a specified value, confirm that the message is a message of the current latest event, and execute the event corresponding to the message;
[0009] If the difference between the event version number and the first reference version number is not a specified value, confirm that the message is not the message of the current latest event, and record the message until the message of the current latest event is received, and execute the events corresponding to each message in sequence according to the timing of each recorded message; wherein the timing of each message is determined by the event version number carried by the message.
[0010] Optionally, the method further includes:
[0011] In response to the completion of the execution of the current latest event, the event version number of the message corresponding to the current latest event is updated locally as the first reference version number.
[0012] Optionally, the message sending device maintains event version numbers for different dimensions respectively, a message carries a real-time version number, and multiple related messages carry the same version number, the real-time version numbers under the same dimension are continuously increasing numbers, and the dimension includes at least one of a user dimension and a business dimension; the message sending device includes a distributed system.
[0013] Optionally, when receiving the event trigger request, the message sender device obtains a local second reference version number for the target dimension according to the target dimension corresponding to the event trigger request, and increases a specified value on the basis of the second reference version number to obtain an event version number for the event trigger request, so as to carry the event version number when sending a message for the event trigger request to the message recipient device;
[0014] The second reference version number is the event version number assigned by the message sending device to the event trigger request for the last successful message sending under the target dimension.
[0015] Optionally, in response to receiving the message, the step of obtaining the event version number carried in the message and comparing it with the first reference version number recorded locally includes:
[0016] In response to receiving the message, an event version number carried by the message and a target dimension corresponding to the message are obtained, and compared with a first reference version number under the target dimension recorded locally.
[0017] In a second aspect, an embodiment of the present invention provides another message push processing method, including:
[0018] In response to the event triggering request, obtaining a second reference version number of the local record, and increasing a specified value on the basis of the second reference version number to obtain an event version number for the event triggering request;
[0019] Sending a message for the event trigger request to a message receiving device, and carrying the event version number in the message;
[0020] The second reference version number is the event version number assigned by the message sending device to the event triggering request for the last successful message sending.
[0021] Optionally, it also includes:
[0022] In response to the message being sent successfully, the event version number of the event trigger request is updated locally as the second reference version number.
[0023] Optionally, the message sending device maintains event version numbers for different dimensions respectively, a message carries a real-time version number, and multiple related messages carry the same version number, the real-time version numbers under the same dimension are continuously increasing numbers, and the dimension includes at least one of a user dimension and a business dimension; the message sending device includes a distributed system.
[0024] Optionally, the step of obtaining a second reference version number of the local record in response to the event triggering request, and increasing a specified value on the basis of the second reference version number to obtain an event version number for the event triggering request includes:
[0025] In response to an event trigger request, according to the target dimension corresponding to the event trigger request, a local second reference version number for the target dimension is obtained, and a specified value is added to the second reference version number to obtain an event version number for the event trigger request.
[0026] In a third aspect, an embodiment of the present invention provides a message push processing device, including:
[0027] A version number acquisition module, configured to, in response to receiving a message, acquire an event version number carried in the message, and compare it with a first reference version number recorded locally, wherein the event version number carried in the message is determined by the message sender device according to a triggering order of an event corresponding to the message;
[0028] A first event execution module, configured to confirm that the message is a message of the current latest event and execute the event corresponding to the message if the difference between the event version number carried by the message and the first reference version number is a specified value;
[0029] The second event execution module is used to confirm that the message is not the message of the current latest event if the difference between the event version number and the first reference version number is not a specified value, and record the message until the message of the current latest event is received, and execute the events corresponding to each message in sequence according to the timing of each recorded message; wherein the timing of each message is determined by the event version number carried by the message.
[0030] Optionally, the device further comprises:
[0031] The first version number maintenance module is used to update the event version number of the message corresponding to the current latest event as the first reference version number to the local in response to the completion of the current latest event execution.
[0032] Optionally, the message sending device maintains event version numbers for different dimensions respectively, a message carries a real-time version number, and multiple related messages carry the same version number, the real-time version numbers under the same dimension are continuously increasing numbers, and the dimension includes at least one of a user dimension and a business dimension; the message sending device includes a distributed system.
[0033] Optionally, when receiving the event trigger request, the message sender device obtains a local second reference version number for the target dimension according to the target dimension corresponding to the event trigger request, and increases a specified value on the basis of the second reference version number to obtain an event version number for the event trigger request, so as to carry the event version number when sending a message for the event trigger request to the message recipient device;
[0034] The second reference version number is the event version number assigned by the message sending device to the event trigger request for the last successful message sending under the target dimension.
[0035] Optionally, the version number acquisition module is specifically used to: in response to receiving a message, obtain the event version number carried by the message and the target dimension corresponding to the message, and compare them with the first reference version number under the target dimension recorded locally.
[0036] In a fourth aspect, an embodiment of the present invention provides a message push processing device, including:
[0037] A version number generation module, used to obtain a second reference version number of a local record in response to an event triggering request, and increase a specified value on the basis of the second reference version number to obtain an event version number for the event triggering request;
[0038] A message sending module, used for sending a message for the event triggering request to a message receiving device, and carrying the event version number in the message;
[0039] The second reference version number is the event version number assigned by the message sending device to the event triggering request for the last successful message sending.
[0040] Optionally, the device further comprises:
[0041] The second version number maintenance module is used to update the event version number of the event trigger request as the second reference version number to the local in response to the message being sent successfully.
[0042] Optionally, the message sending device maintains event version numbers for different dimensions respectively, a message carries a real-time version number, and multiple related messages carry the same version number, the real-time version numbers under the same dimension are continuously increasing numbers, and the dimension includes at least one of a user dimension and a business dimension; the message sending device includes a distributed system.
[0043] Optionally, the version number generation module can be specifically used to: in response to an event trigger request, obtain a local second reference version number for the target dimension corresponding to the event trigger request, and add a specified value to the second reference version number to obtain an event version number for the event trigger request.
[0044] In the fifth aspect, an embodiment of the present invention further provides an electronic device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the computer program is executed by the processor, the steps of the message push processing method described in the first aspect and / or the second aspect are implemented.
[0045] In the sixth aspect, an embodiment of the present invention further provides a computer-readable storage medium, characterized in that a computer program is stored on the computer-readable storage medium, and when the computer program is executed by the processor, the steps of the message push processing method described in the first aspect and / or the second aspect are implemented.
[0046] In an embodiment of the present invention, an event version number is maintained by the producer and subscriber of the message respectively. According to the change rule of the event version number, the business continuity of the event corresponding to the message can be determined. If it is found that the event corresponding to the message is continuous with the event version number maintained locally by the subscriber, the currently received message is considered to be the latest message and is directly processed. If it is found that the event corresponding to the message is not continuous with the event version number maintained locally by the subscriber, the currently received message is considered not to be the message corresponding to the latest event, and the message needs to be temporarily stored to wait for the arrival of the latest event message, and then the execution order of each event is determined based on the event version number carried by each message. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] Figure 1 This is one of the step flow charts of a message push processing method in an embodiment of the present invention;
[0048] Figure 2A This is a schematic diagram of an existing message push processing flow in an embodiment of the present invention;
[0049] Figure 2B is a flow chart of a message push processing method in an embodiment of the present invention;
[0050] Figure 3 This is a second step flow chart of a message push processing method in an embodiment of the present invention;
[0051] Figure 4 This is a flowchart of the steps of a message push processing method in an embodiment of the present invention;
[0052] Figure 5 It is a structural diagram of a message push processing device in an embodiment of the present invention;
[0053] Figure 6 It is a structural diagram of another message push processing device in an embodiment of the present invention. DETAILED DESCRIPTION
[0054] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0055] Reference Figure 1 , shows a step flow chart of a message push processing method in an embodiment of the present invention, which is applied to a message receiving device.
[0056] Step 110, in response to receiving the message, obtaining an event version number carried in the message, and comparing it with a first reference version number recorded locally, wherein the event version number carried in the message is determined by the message sender device according to a triggering order of an event corresponding to the message;
[0057] Step 120: If the difference between the event version number carried by the message and the first reference version number is a specified value, confirm that the message is a message of the current latest event, and execute the event corresponding to the message;
[0058] Step 130: If the difference between the event version number and the first reference version number is not a specified value, confirm that the message is not the message of the current latest event, and record the message until the message of the current latest event is received, and execute the events corresponding to each message in sequence according to the timing of each recorded message; wherein the timing of each message is determined by the event version number carried by the message.
[0059] As mentioned above, it is difficult to ensure the timing of messages in a distributed system in the existing design for solving message idempotence. That is, events that are triggered first are processed first. If the message that triggers the event first does not reach the subscriber, that is, the message receiver, it is difficult to process the message in the order in which the event occurred. For messages published by publishers (that is, message senders), some messages may be related to the time sequence of business logic occurrence. The subscriber of the message can only effectively process the message when the time sequence of the received message is consistent with the time sequence of the business occurrence, otherwise a business logic exception will occur.
[0060] like Figure 2A As shown in the figure, assuming that event 1 and event 2 have a certain logical relationship, event 2 is only valid when event 1 occurs first, so the message corresponding to event 1 should be processed first, and then the message corresponding to event 2. Only by processing the message corresponding to event 1 first can the correct logical processing be made for the message corresponding to event 2.
[0061] For example, assuming that event 1 is a recharge event and event 2 is a consumption event, the message publisher can be any user's client, and the subscriber is the server used to handle events such as recharge and consumption. The subscriber adds the recharge amount to the user's balance. According to the total balance of the total user account, the consumption message corresponding to event 2 can be correctly processed according to the current total balance of the account (if the balance is sufficient, the fee will be deducted, and if the balance is insufficient, the payment is considered to have failed). Due to the problems of distributed systems, asynchronous processing design, network delays, business logic, etc. in the current large-scale concurrency scenario of the Internet, it is difficult to guarantee 100% timing of messages. When the timing of the message is abnormal (for example, the message of event 2 arrives at the message proxy service first, and the message proxy service prioritizes pushing the message of event 2 to the subscriber, etc.), manual intervention is usually required to process the data and repair it manually.
[0062] In an embodiment of the present invention, in order to solve the problem of message timing, in a distributed system, the message producer (i.e., the message sender) and the subscriber (i.e., the message receiver) can respectively maintain an event version number, and the event version number can be a continuously increasing number (e.g., a number that increases by a specified value each time, wherein the initial event version number can be customized according to requirements), and the increment of the event version number each time can be customized according to requirements, which is not limited in the embodiment of the present invention. Of course, according to requirements, the event version number can also be a continuously decreasing number, or a number, symbol combination that gradually changes in other ways, etc., which is not limited in the embodiment of the present invention. In addition, in an embodiment of the present invention, the event version number can also be set to change periodically, for example, every certain time period (e.g., one week, one month, etc.), the event version number is restored to the initial value, and the continuous increase or decrease is restarted, and so on.
[0063] Then, during the message transmission process, the message can carry the event version number of the event to which it corresponds, and the message receiver can determine the business continuity of the event corresponding to the message according to the value change rule of the event version number carried by the message. If it is found that the event corresponding to the message is continuous with the event version number maintained locally as the reference version number by the subscriber (for example, when the event version number is continuously increasing, the difference between the event version number carried by the message and the first reference version number is a specified value), then it can be considered that the currently received message is the message corresponding to the latest event, and the corresponding event can be processed directly. If it is found that the event corresponding to the message is not continuous with the event version number maintained locally by the subscriber (for example, when the event version number is continuously increasing, the difference between the event version number carried by the message and the first reference version number is not a specified value), then it can be considered that the currently received message is not the message corresponding to the latest event, and the message needs to be temporarily stored, waiting for the arrival of the latest event message, and then according to the event version number of each stored message, the timing of each message is determined and the events corresponding to each message are executed in sequence.
[0064] The event version number carried by each message is determined by the message sender device according to the triggering order of the event corresponding to the message, that is, the timing of each message, that is, the execution order, is determined by the event version number carried by the message.
[0065] Reference Figure 3 In the embodiment of the present invention, it may also include:
[0066] Step 140: In response to the completion of the execution of the current latest event, the event version number of the message corresponding to the current latest event is updated locally as the first reference version number.
[0067] Optionally, in an embodiment of the present invention, the message sending device maintains event version numbers for different dimensions respectively, a message carries a real-time version number, and multiple related messages carry the same version number, the real-time version number under the same dimension is a continuously increasing number, and the dimension includes at least one of a user dimension and a business dimension.
[0068] Optionally, in the embodiment of the present invention, when receiving the event trigger request, the message sender device obtains a local second reference version number for the target dimension according to the target dimension corresponding to the event trigger request, and increases a specified value on the basis of the second reference version number to obtain an event version number for the event trigger request, so as to carry the event version number when sending a message for the event trigger request to the message recipient device;
[0069] The second reference version number is the event version number assigned by the message sending device to the event trigger request for the last successful message sending under the target dimension.
[0070] Reference Figure 3 In the embodiment of the present invention, step 110 may further include:
[0071] Step 111, in response to receiving a message, obtain an event version number carried by the message and a target dimension corresponding to the message, and compare them with a first reference version number under the target dimension recorded locally.
[0072] In the embodiment of the present invention, if the message sender device needs to send the message to the message receiver device through the message proxy service, the message proxy service can directly push the message to the message subscriber without any special processing when receiving the message.
[0073] After receiving the message, the message subscriber first takes out the event version number attached to the message and compares it with the first reference version number maintained locally. Assuming that the above specified value is 1, then when the event version number of the received message - the local first reference version number = 1, the received message is considered to be the message of the latest event, and the message is directly processed with normal business logic, that is, the event corresponding to the message (such as a payment event, etc.) is executed. When the received message version number - the local message version number>1, the received message is not considered to be the message of the latest event, and the message needs to be temporarily stored, waiting for the arrival of the latest event message, and then uniformly processed according to the timing of the message.
[0074] Among them, for the message sending device, its user can trigger an event request through normal operation. Then, when the message sending device receives the user's event trigger request, in addition to normal addition and modification of user data, it can also maintain an event version number field (such as event_msg_version field) as a second reference version number.
[0075] In addition, in an embodiment of the present invention, in order to subdivide different dimensions and ensure the timing of event execution in each dimension, event version numbers can be maintained separately for different dimensions. Then, the second reference version number in each dimension can be stored locally on the message sender's device, and the second reference version number in the corresponding dimension can be updated in real time according to the message sending situation in each dimension to ensure that the second reference version number is the event version number of the latest event in the corresponding dimension that has successfully sent the message.
[0076] Correspondingly, for the message receiving device, the first reference version number can also be performed for different dimensions to ensure that the event version number of the latest event that has been executed under each dimension is recorded as the first reference version number under the corresponding dimension, and this embodiment of the present invention is not limited to this.
[0077] It should be noted that, in the embodiment of the present invention, the latest event can be understood as the event that is triggered first among all unexecuted events, and the event that needs to be executed first according to the time sequence.
[0078] If the message sender assigns event version numbers that are continuously increasing in order of event triggering from first to last, then the message receiver can execute the events corresponding to the messages in order from low to high according to the event version numbers carried by each message, thereby ensuring that the event triggered first is executed first.
[0079] In the embodiment of the present invention, event messages with related relationships (such as messages of events that need to be executed at the same time) can use the same event version number, and the event version number can be bound to the user, or to a unique business that needs to maintain the timing of messages in a specific scenario, or can also be bound to a combination of user type and business type. That is, the real-time version number under the same dimension is a continuously increasing number, and the dimension includes at least one of the user dimension and the business dimension.
[0080] like Figure 2B As shown, it is assumed that the message sending device is any device in the distributed system. For the distributed system, taking the user as a dimension as an example, it is assumed that the specified value is 1. When receiving the user's event trigger request, in addition to the normal addition and modification of user data, an event version number field for the user should also be maintained (for example: event_msg_version). When the distributed system processes the user's event trigger request, it can synchronize threads and processes in a safe manner (for example, optimistic locking can be used) to increment the event version number field by 1. Similar: event_msg_version = event_msg_version + 1; wherein, the event_msg_version used as the basis for increment can also be understood as the current second reference version number, and the incremented event_msg_version is the event version number of the event triggered this time.
[0081] Of course, in the embodiment of the present invention, the sending device may also store the second reference version number in a designated storage module, such as Figure 2BAs shown, each distributed system as a sender can share the second reference version number. When the same user sends messages through different sender devices, the event version numbers in each sender device can be synchronized, ensuring that the event version numbers carried by the messages sent by the same user through different sender devices can accurately represent the execution order of the events corresponding to each message.
[0082] The rule for maintaining the event version number of the message receiving device is similar to that of the message sending device, and is not described in detail here. For example, the message receiving device can also maintain each dimension, or an event version number field (such as event_msg_version) under the dimension to which it belongs, to record the first reference version number, and update the field in an incremental manner, and so on.
[0083] After the distributed system processes the user's trigger event request and successfully increments the event version number, when sending a message for the corresponding trigger event request, the event version number information of the corresponding event can be attached to the message.
[0084] Reference Figure 4 , shows a step flow chart of another message push processing method in an embodiment of the present invention, which can be applied to a message sending device.
[0085] Step 210, in response to the event triggering request, obtaining a second reference version number of the local record, and adding a specified value to the second reference version number to obtain an event version number for the event triggering request;
[0086] Step 220, sending a message for the event trigger request to a message receiving device, and carrying the event version number in the message;
[0087] The second reference version number is the event version number assigned by the message sending device to the event triggering request for the last successful message sending.
[0088] Optionally, in the embodiment of the present invention, the following may also be included:
[0089] Step 230: In response to the message being sent successfully, the event version number of the event trigger request is updated locally as the second reference version number.
[0090] Optionally, in an embodiment of the present invention, the message sending device maintains event version numbers for different dimensions respectively, a message carries a real-time version number, and multiple related messages carry the same version number, the real-time version number under the same dimension is a continuously increasing number, and the dimension includes at least one of a user dimension and a business dimension; the message sending device includes a distributed system.
[0091] Optionally, in an embodiment of the present invention, step 210 may further include: in response to an event trigger request, obtaining a local second reference version number for the target dimension according to the target dimension corresponding to the event trigger request, and adding a specified value to the second reference version number to obtain an event version number for the event trigger request.
[0092] Among them, the specific details of the message sending device executing the above steps and the message sending process between the message sending device and the message receiving device are similar to the above embodiments. For details, please refer to the contents described in the above embodiments and will not be repeated here.
[0093] In the embodiment of the present invention, an event version number field is stored and maintained by the message producer and message consumer in the business system respectively. Moreover, the event version number is continuous, and the subscriber determines the timing of the event occurrence by the difference between the event version number of the message and the event version number maintained locally. After the subscriber determines the timing of the message, he can choose to perform normal business processing or temporarily store the message locally. In this way, the system anomalies caused by the timing of the message can be solved, and the real-time processing of normal messages is hardly affected.
[0094] Reference Figure 5 , shows a structural schematic diagram of a message push processing device in an embodiment of the present invention.
[0095] The message push processing device of the embodiment of the present invention can be applied to a message receiving device, and the device includes: a version number acquisition module 310 , a first event execution module 320 and a second event execution module 330 .
[0096] The functions of each module and the interactions between them are introduced in detail below.
[0097] A version number acquisition module 310 is used to, in response to receiving a message, acquire an event version number carried in the message and compare it with a first reference version number recorded locally, where the event version number carried in the message is determined by the message sender device according to a triggering order of an event corresponding to the message;
[0098] A first event execution module 320, configured to confirm that the message is a message of the current latest event if the difference between the event version number carried by the message and the first reference version number is a specified value, and execute the event corresponding to the message;
[0099] The second event execution module 330 is used to confirm that the message is not the message of the current latest event if the difference between the event version number and the first reference version number is not a specified value, and record the message until the message of the current latest event is received, and execute the events corresponding to each message in sequence according to the timing of each recorded message; wherein the timing of each message is determined by the event version number carried by the message.
[0100] Optionally, in the embodiment of the present invention, the device further includes:
[0101] The first version number maintenance module is used to update the event version number of the message corresponding to the current latest event as the first reference version number to the local in response to the completion of the current latest event execution.
[0102] Optionally, in an embodiment of the present invention, the message sending device maintains event version numbers for different dimensions respectively, a message carries a real-time version number, and multiple related messages carry the same version number, the real-time version number under the same dimension is a continuously increasing number, and the dimension includes at least one of a user dimension and a business dimension; the message sending device includes a distributed system.
[0103] Optionally, in the embodiment of the present invention, when receiving the event trigger request, the message sender device obtains a local second reference version number for the target dimension according to the target dimension corresponding to the event trigger request, and increases a specified value on the basis of the second reference version number to obtain an event version number for the event trigger request, so as to carry the event version number when sending a message for the event trigger request to the message recipient device;
[0104] The second reference version number is the event version number assigned by the message sending device to the event trigger request for the last successful message sending under the target dimension.
[0105] Optionally, in an embodiment of the present invention, the version number acquisition module is specifically used to: in response to receiving a message, obtain the event version number carried by the message and the target dimension corresponding to the message, and compare them with the first reference version number under the target dimension recorded locally.
[0106] The message push processing device provided by the embodiment of the present invention can realize Figures 1 to 3 To avoid repetition, the various processes implemented in the method embodiment are not described here.
[0107] Reference Figure 6 , shows a structural schematic diagram of a message push processing device in an embodiment of the present invention.
[0108] The message push processing device of the embodiment of the present invention can be applied to a message sending device, and the device includes: a version number generating module 410 and a message sending module 420 .
[0109] The functions of each module and the interactions between them are introduced in detail below.
[0110] The version number generating module 410 is used to obtain the second reference version number of the local record in response to the event triggering request, and increase the specified value on the basis of the second reference version number to obtain the event version number for the event triggering request;
[0111] A message sending module 420 is used to send a message for the event trigger request to a message receiving device, and carry the event version number in the message;
[0112] The second reference version number is the event version number assigned by the message sending device to the event triggering request for the last successful message sending.
[0113] Optionally, in the embodiment of the present invention, the device further includes:
[0114] The second version number maintenance module is used to update the event version number of the event trigger request as the second reference version number to the local in response to the message being sent successfully.
[0115] Optionally, in an embodiment of the present invention, the message sending device maintains event version numbers for different dimensions respectively, a message carries a real-time version number, and multiple related messages carry the same version number, the real-time version number under the same dimension is a continuously increasing number, and the dimension includes at least one of a user dimension and a business dimension; the message sending device includes a distributed system.
[0116] Optionally, in an embodiment of the present invention, the version number generation module can be specifically used to: in response to an event trigger request, obtain a local second reference version number for the target dimension according to the target dimension corresponding to the event trigger request, and add a specified value to the second reference version number to obtain an event version number for the event trigger request.
[0117] Preferably, an embodiment of the present invention further provides an electronic device, comprising: a processor, a memory, and a computer program stored in the memory and executable on the processor. When the computer program is executed by the processor, the various processes of the above-mentioned information processing method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be described here.
[0118] The embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, each process of the above-mentioned information processing method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it is not repeated here. The computer-readable storage medium is, for example, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0119] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0120] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for enabling a terminal (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in each embodiment of the present invention.
[0121] The embodiments of the present invention are described above in conjunction with the accompanying drawings, but the present invention is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the enlightenment of the present invention, ordinary technicians in this field can also make many forms without departing from the scope of protection of the present invention and the claims, all of which are within the protection of the present invention.
[0122] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed in the embodiments of the present invention can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0123] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0124] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0125] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0126] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0127] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as USB flash drives, mobile hard disks, ROM, RAM, magnetic disks, or optical disks.
[0128] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.
Claims
1. A message push processing method, characterized in that: Applied to a message receiving device, the method comprises: In response to receiving the message, obtaining an event version number carried by the message, and comparing it with a first reference version number recorded locally, wherein the event version number carried by the message is determined by the message sender device according to a triggering order of an event corresponding to the message; If the difference between the event version number carried by the message and the first reference version number is a specified value, the message is confirmed to be a message of the current latest event, and the event corresponding to the message is executed; the latest event is the event that is triggered first among all unexecuted events and the event that needs to be executed first according to the time sequence; If the difference between the event version number and the first reference version number is not a specified value, confirm that the message is not a message of the current latest event, and record the message until the message of the current latest event is received, and execute the events corresponding to the messages in sequence according to the time sequence of the recorded messages; wherein the time sequence of each message is determined by the event version number carried by the message; The message sender device maintains event version numbers for different dimensions respectively, one message carries a real-time version number, and multiple messages with associated relationships carry the same version number, and the real-time version numbers under the same dimension are continuously increasing numbers, and the dimension includes at least one of a user dimension and a business dimension; the message sender device includes a distributed system, wherein the associated event messages include: messages of events that need to be executed simultaneously; When the message sending device receives an event trigger request, it obtains a local second reference version number for the target dimension corresponding to the event trigger request, and increases a specified value on the basis of the second reference version number to obtain an event version number for the event trigger request, so as to carry the event version number when sending a message for the event trigger request to the message receiving device; wherein the second reference version number is the event version number assigned by the message sending device to the event trigger request for the previous successful message sending under the target dimension; the second reference version number is stored in a preset storage module so that the message sender shares the second reference version number in the distributed system.
2. The method according to claim 1, characterized in that The method further comprises: In response to the completion of the execution of the current latest event, the event version number of the message corresponding to the current latest event is updated locally as the first reference version number.
3. The method according to claim 1, characterized in that The step of obtaining, in response to receiving the message, the event version number carried by the message and comparing it with the first reference version number recorded locally includes: In response to receiving the message, an event version number carried by the message and a target dimension corresponding to the message are obtained, and compared with a first reference version number under the target dimension recorded locally.
4. A message push processing method, characterized in that: Applied to a message sending device, the method includes: In response to an event trigger request, obtaining a second reference version number of a local record, and adding a specified value to the second reference version number to obtain an event version number for the event trigger request, including: in response to the event trigger request, according to the target dimension corresponding to the event trigger request, obtaining a local second reference version number for the target dimension, and adding a specified value to the second reference version number to obtain an event version number for the event trigger request; the message sender device maintains event version numbers for different dimensions respectively, a message carries a real-time version number, and multiple associated messages carry the same version number, the real-time version number under the same dimension is a continuously increasing number, and the dimension includes at least one of a user dimension and a business dimension; the message sender device includes a distributed system; the second reference version number is stored in a preset storage module so that the message sender shares the second reference version number in the distributed system; Sending a message for the event trigger request to a message receiving device, and carrying the event version number in the message; The second reference version number is the event version number assigned by the message sending device to the event triggering request for the last successful message sending.
5. The method according to claim 4, characterized in that Also includes: In response to the message being sent successfully, the event version number of the event triggering request is updated locally as the second reference version number.
6. A message push processing device, characterized in that: Applied to a message receiving device, the apparatus comprises: A version number acquisition module is used to obtain, in response to receiving a message, an event version number carried by the message, and compare it with a first reference version number recorded locally, wherein the event version number carried by the message is determined by the message sender device according to the triggering order of the event corresponding to the message, including: in response to an event triggering request, according to the target dimension corresponding to the event triggering request, obtaining a local second reference version number for the target dimension, and adding a specified value to the second reference version number to obtain the event version number for the event triggering request; the message sender device maintains event version numbers for different dimensions respectively, a message carries a real-time version number, and multiple associated messages carry the same version number, the real-time version number under the same dimension is a continuously increasing number, and the dimension includes at least one of a user dimension and a business dimension; the message sender device includes a distributed system; the second reference version number is stored in a preset storage module so that the message sender shares the second reference version number in the distributed system; A first event execution module is used to confirm that the message is a message of the current latest event and execute the event corresponding to the message if the difference between the event version number carried by the message and the first reference version number is a specified value; the latest event is the event that is triggered first among all unexecuted events and the event that needs to be executed first according to the time sequence; The second event execution module is used to confirm that the message is not the message of the current latest event if the difference between the event version number and the first reference version number is not a specified value, and record the message until the message of the current latest event is received, and execute the events corresponding to each message in sequence according to the timing of each recorded message; wherein the timing of each message is determined by the event version number carried by the message.
7. A message push processing device, characterized in that: Applied to a message sending device, the apparatus comprises: A version number generation module is used to obtain a second reference version number of a local record in response to an event trigger request, and increase a specified value on the basis of the second reference version number to obtain an event version number for the event trigger request; the second reference version number is stored in a preset storage module so that the message sender can share the second reference version number in a distributed system; A message sending module, used for sending a message for the event triggering request to a message receiving device, and carrying the event version number in the message; The second reference version number is the event version number assigned by the message sending device to the event triggering request for the last successful message sending.
8. An electronic device, characterized in that: include: A processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the steps of the message push processing method as claimed in any one of claims 1 to 5.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the message push processing method according to any one of claims 1 to 5 are implemented.
