CN109614246B - Message processing method and device and message processing server - Google Patents

Message processing method and device and message processing server Download PDF

Info

Publication number
CN109614246B
CN109614246B CN201811332252.9A CN201811332252A CN109614246B CN 109614246 B CN109614246 B CN 109614246B CN 201811332252 A CN201811332252 A CN 201811332252A CN 109614246 B CN109614246 B CN 109614246B
Authority
CN
China
Prior art keywords
message
processed
processing
queue
initial value
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201811332252.9A
Other languages
Chinese (zh)
Other versions
CN109614246A (en
Inventor
郑巨双
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Infineon Information Co ltd
Original Assignee
Shenzhen Infinova Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Infinova Ltd filed Critical Shenzhen Infinova Ltd
Priority to CN201811332252.9A priority Critical patent/CN109614246B/en
Publication of CN109614246A publication Critical patent/CN109614246A/en
Application granted granted Critical
Publication of CN109614246B publication Critical patent/CN109614246B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/546Message passing systems or structures, e.g. queues

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention is suitable for the technical field of information processing, and provides a method and a device for processing a message and a message processing server, wherein the method comprises the following steps: acquiring a message to be processed carrying a first message ID from a message queue; determining a third message ID of the expected processing message according to the second message ID of the historical processing message; and if the first message ID is the same as the third message ID, processing the message to be processed. The embodiment of the invention compares the first message ID corresponding to the message to be processed with the third message ID corresponding to the message to be processed, and processes the message to be processed when the first message ID and the third message ID are the same, thereby ensuring that the message to be processed is the message which is expected to be processed by the message processing server at present, and avoiding the message disorder problem in the message processing process.

Description

Message processing method and device and message processing server
Technical Field
The present invention belongs to the field of information processing technologies, and in particular, to a method and an apparatus for processing a message, and a message processing server.
Background
With the rapid development of the internet of things technology, more and more devices are accessed into the internet of things platform through the network, and a large number of devices generate massive messages. At present, after messages generated by a device are forwarded by a device management server and a message forwarding server, since it cannot be determined which message forwarding server each message is forwarded by, in a message queue obtained after forwarding, problems of message order confusion and message repetition may occur. For example, the original message sequence is 1, 2, 3, 4, but in the message queue, the message sequence becomes 1, 3, 4, 2, which is message sequence disorder, and if the message sequence in the message queue becomes 1, 3, 4, 2, which is message sequence disorder and message repetition.
Disclosure of Invention
In view of this, embodiments of the present invention provide a method and an apparatus for message processing, and a message processing server, so as to solve the problem of message order confusion occurring during message processing in the prior art.
A first aspect of an embodiment of the present invention provides a method for processing a message, including:
acquiring a message to be processed carrying a first message ID from a message queue;
determining a third message ID of the expected processing message according to the second message ID of the historical processing message;
and if the first message ID is the same as the third message ID, processing the message to be processed.
A second aspect of the embodiments of the present invention provides a message processing apparatus, including:
the message acquisition module is used for acquiring a message to be processed carrying a first message ID from the message queue;
a third message ID determining module, configured to determine a third message ID of an expected processed message according to the second message ID of the historical processed message;
and the message processing module is used for processing the message to be processed if the first message ID is the same as the third message ID.
A third aspect of embodiments of the present invention provides a message processing server, including a processor, an input device, an output device, and a memory, where the processor, the input device, the output device, and the memory are connected to each other, where the memory is used to store a computer program, and the computer program includes program instructions, and the processor is configured to call the program instructions to execute the method according to the first aspect.
A fourth aspect of embodiments of the present invention provides a computer-readable storage medium having stored thereon a computer program comprising program instructions which, when executed by a processor, cause the processor to perform the method of the first aspect described above.
The embodiment of the invention compares the first message ID corresponding to the message to be processed with the third message ID corresponding to the message to be processed, and processes the message to be processed when the first message ID and the third message ID are the same, thereby ensuring that the message to be processed is the message which is expected to be processed by the message processing server at present, and avoiding the message disorder problem in the message processing process.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the embodiments or the prior art descriptions will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without inventive exercise.
Fig. 1 is a schematic flow chart of an implementation of a method for processing a message according to an embodiment of the present invention;
fig. 2 is a schematic flow chart of an implementation of another method for message processing according to an embodiment of the present invention;
fig. 2a is a log table for processing a fault message according to an embodiment of the present invention;
fig. 3 is a schematic flow chart of an implementation of another method for message processing according to an embodiment of the present invention;
FIG. 3a is a log table for processing alarm messages according to an embodiment of the present invention;
fig. 4 is a schematic diagram of a message processing apparatus according to an embodiment of the present invention;
fig. 5 is a schematic diagram of a message processing server according to an embodiment of the present invention.
Detailed Description
In the following description, for purposes of explanation and not limitation, specific details are set forth, such as particular system structures, techniques, etc. in order to provide a thorough understanding of the embodiments of the invention. It will be apparent, however, to one skilled in the art that the present invention may be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present invention with unnecessary detail.
In order to explain the technical means of the present invention, the following description will be given by way of specific examples.
The first embodiment is as follows:
referring to fig. 1, fig. 1 is a flowchart illustrating a method for processing a message according to an embodiment of the present invention, which is detailed as follows:
step S101: and acquiring the message to be processed carrying the first message ID from the message queue.
The message queue is a container for storing messages in the message transmission process, and all the messages after being forwarded are stored in the message queue.
When the message processing server processes the message, only one message to be processed is read from the message queue each time, and the message to be processed carries the first message ID.
Step S102: a third message ID of the intended processed message is determined based on the second message ID of the historically processed message.
The history processing message is a message recently processed by the message processing server, and the corresponding message ID is the second message ID. The expected processing message is a message which is expected to be processed currently by the message processing server, and the corresponding message ID is the third message ID.
From the second message ID, a third message ID may be determined. Specifically, the first way of determining the third message ID according to the second message ID may be: the third message ID is sequentially incremented on the basis of the second message ID, e.g., 1001 for the second message ID, 1002 for the third message ID. The second determination method may also be: the third message ID is the same as the second message ID, for example, the second message ID is 1001, and the third message ID is also 1001.
The second way of determining is to consider that some message types, such as fault messages, are paired. For the same fault, which includes a fault activation message and a fault recovery message, in order to enable the processor to associate the fault activation message and the fault recovery message of the same fault, the same ID is used to identify the fault activation message and the fault recovery message corresponding to the fault.
Step S103: and if the first message ID is the same as the third message ID, processing the message to be processed.
Specifically, if the first message ID is the same as the third message ID, it indicates that the message to be processed is an expected processing message, i.e., a message that the device terminal currently expects to process, and therefore the message to be processed needs to be processed immediately.
In this embodiment, the first message ID corresponding to the message to be processed is compared with the third message ID corresponding to the message to be processed, and the message to be processed is processed only when the first message ID and the third message ID are the same as each other, so that the message to be processed is ensured to be the message which is expected to be processed by the message processing server currently, and the message disorder problem in the message processing process is avoided.
Example two:
referring to fig. 2, fig. 2 is a flowchart illustrating a message processing method according to another embodiment of the present invention, which is detailed as follows:
step S201: and acquiring the message to be processed carrying the first message ID from the message queue.
In this embodiment, S201 is the same as S101 in the previous embodiment, and please refer to the related description of S101 in the previous embodiment, which is not repeated herein.
Step S202: a third message ID of the intended processed message is determined based on the second message ID of the historically processed message.
In this embodiment, S202 is the same as S102 in the previous embodiment, and please refer to the related description of S102 in the previous embodiment, which is not repeated herein.
Step S203: and if the message to be processed is a fault message, acquiring a first message state of the message to be processed.
It should be noted that the fault message generally occurs in pairs, and for the same fault, the fault message includes a fault activation message and a fault recovery message, and the message states corresponding to the fault activation message and the fault recovery message are a fault activation state and a fault recovery state, respectively.
In order to enable the message processing server to associate the same fault activation message and fault recovery message with each other, the same ID is used to identify the fault activation message and the fault recovery message corresponding to the fault. For example, for a battery failure that includes a battery failure activation message and a battery failure recovery message, if the ID of the battery failure activation message is set to 1001, then the ID of the battery failure recovery message is also set to 1001. Since the IDs of the failover message and the failover message are the same, it is necessary to distinguish whether a message is a failover message or a failover message by the message status.
Therefore, in order to determine whether to process the message to be processed, in addition to acquiring the first message ID of the message to be processed, the first message status of the message to be processed needs to be acquired.
It should be noted that, since the faults may be classified into different types, for example, the faults may be classified into different fault types such as a battery fault, an audio fault, a display fault, and the like. The number of the message ID thereof sequentially increases from a preset initial value for each type of failure, but the preset initial value is different for different failure types of messages. For example, a message ID for a type of failure such as a battery failure may be numbered beginning with 1001, a message ID for a type of failure such as an audio failure may be numbered beginning with 1020, and a message ID for a type of failure such as a display failure may be numbered beginning with 1040.
Step S204: and determining a third message state and a third message ID of the expected processing message according to the second message state and the second message ID of the historical processing message.
The history processing message is a message recently processed by the message processing server, and the corresponding second message state can be obtained from the history processing message.
It should be noted that, as mentioned in step S203, since the fault message has the characteristic of occurring in pairs, the same fault includes the fault activation message and the fault recovery message, and the IDs used for the fault activation message and the fault recovery message of the same fault are the same, it is necessary to determine the third message ID and the third message state corresponding to the expected processing message by combining the second message ID and the second message state corresponding to the historical processing message.
Hereinafter, the form of "message ID (message status)" is used to indicate the message ID and message status corresponding to a message, and the letters N and M are used to respectively represent message IDs of different fault types, for example, N is used to represent the message ID of a battery fault, and M is used to represent the message ID of an audio fault.
The specific determination method comprises the following steps: if the second message ID and the second message status are in the history processing message: n (fail-active state), then the third message ID and the third message state for the intended processing message should be: n (fault recovery state), or is: m (fault activation status); if the second message ID and the second message status are: n (fail-over state), then the third message ID and the third message state of the expected processing message are: n +1 (fault activated state), or is: m (fault activated state).
For example, in the processing of the failure message, the history processing message is: 1001 (battery failure active state), then the expected processing message may be: 1001 (battery failure recovery state) and may also be 1020 (audio failure active state).
Step S205: and if the first message ID is the same as the third message ID and the first message state is the same as the third message state, processing the message to be processed.
When the first message ID is the same as the third message ID and the first message status is the same as the third message status, it indicates that the message to be processed is a message expected to be processed by the processor, and therefore the message to be processed needs to be processed immediately.
Fig. 2a is a log table of processing of a fault message, and fig. 2a shows a specific processing procedure of the fault message. Fig. 2a contains message sequence, message name, timestamp, message ID, message type, whether to immediately process, whether to update status, and the number of times to replace.
First, a pending message, Msg1, is read from the message queue, as shown in the second row of fig. 2 a. Assuming that for this message type of battery failure, a preset initial value is set to 1001, i.e., the message ID of this type is numbered from 1001; for this message type of audio failure, a preset initial value is set to 1020, i.e., the message IDs of this type are numbered from 1020. In the initial state, since the message processing server has not previously processed any message, it is expected to process the message as 1001 (battery failure activated state) or 1020 (audio failure activated state). Therefore, since the first message ID is the same as the third message ID and the first state is the same as the third state, Msg1 needs to be immediately processed, and thus both the parameter values of "whether to immediately process" and "whether to update the state" in fig. 2a are "Y".
After processing the Msg1, the next message to be processed, Msg2, is read from the message queue, as shown in the third row of fig. 2 a. At this time, the history processing message is 1001 (battery failure activated state), and therefore the expected processing message is 1001 (battery failure recovery state), or 1020 (audio failure activated state). Since the first message ID is the same as the third message ID and the first state is the same as the third state, Msg2 also needs to be processed immediately.
Step S206: and if the first message ID is larger than the third message ID, the message is put back to the message queue, and the number of putting back times is recorded.
For example, if the third message ID is 1001 and the first message ID is 1002, it indicates that the message is out of order, and the pending message is not the message that the processor currently expects to process, so the pending message is ignored first, put back into the message queue, and record the number of times of putting back.
It should be noted that, when the message to be processed is placed back into the message queue, a delay is required to be set in order to prevent the message to be processed from being processed by other message processing servers. The delay time may be set according to actual needs, for example, the delay time may be set to 3 seconds or 5 seconds, which is not limited.
Illustratively, Msg5 is read from the message queue, as shown in the fourth row of fig. 2a, the expected processed message at this time is 1001 (battery failure recovery state), and the first message ID of the pending message is 1002, which is larger than the third message ID, indicating that the pending message is not the expected processed message, so the pending message is put back into the message queue, and the parameter of the item "number of putting back" of Msg5 in fig. 2a is recorded as 1.
Step 207: and when the number of the putting back times reaches a preset number, processing the message to be processed.
The preset number of times can be set as required, and is usually set to 3, that is, if the number of times of putting back reaches 3 times, the message to be processed is processed.
When the number of times of putting back the message to be processed reaches a preset number of times, the message to be processed needs to be processed. This is to take into account that if a message is stored in the message queue for a long time and cannot be processed normally, it may not be meaningful to process the message again later.
The processing mode of the message to be processed may be to ignore the message, that is, not to process the message, or may be other processing modes, and may be set according to actual needs, which is not limited herein.
Step S208: and acquiring a first time stamp of the message to be processed.
Wherein, the timestamp refers to a time point when a certain message is generated, and the first timestamp refers to a time point when the message to be processed is generated.
Step S209: and if the first timestamp is less than or equal to a second timestamp of the historical processing message, not processing the message to be processed.
When the first timestamp is less than or equal to the second message timestamp, it is indicated that the message to be processed has been processed before, that is, the message to be processed belongs to a repeated message, and therefore, the message to be processed does not need to be processed any more and can be ignored.
Exemplarily, assuming that a pending message is read from the message queue, as shown in the sixth row of fig. 2a, the first timestamp of the pending message is equal to the second timestamp of the history processed message (as shown in the fifth row of fig. 2 a), which indicates that the pending message is a duplicate message and is not processed, so the parameter values of "whether to process immediately" and "whether to update the status" in the sixth row of fig. 2a are both "N".
It should be noted that, when the to-be-processed message put back in the message queue is read again, if the to-be-processed message has already been processed or is ignored, the parameter of the item "number of times of putting back" corresponding to the to-be-processed message is cleared, as shown in the eighth row in fig. 2 a.
In the embodiment, the characteristic that the fault message appears in pairs is considered, the first message ID corresponding to the message to be processed is compared with the third message ID corresponding to the expected processing message, and the first message state corresponding to the message to be processed is compared with the third message state corresponding to the expected processing message, so that the message to be processed is processed only when the first message ID is the same as the third message ID and the first message state is the same as the third message state, and the message to be processed is ensured to be the message which is expected to be processed by the message processing server currently, thereby avoiding the message disorder problem in the message processing process; and comparing the first time stamp corresponding to the message to be processed with the second time stamp corresponding to the history processing message to judge whether the message to be processed belongs to the repeated message, if the first time stamp is less than or equal to the second time stamp, the message to be processed is not processed, so that the message processing server does not process the repeated message again, and the message repetition problem in the message processing process is solved.
Example three:
referring to fig. 3, fig. 3 is a flowchart illustrating a message processing method according to another embodiment of the present invention, which is detailed as follows:
step S301: and acquiring the message to be processed carrying the first message ID from the message queue.
In this embodiment, S301 is the same as S101 in the first embodiment, and please refer to the related description of S101 in the first embodiment, which is not repeated herein.
Step S302: a third message ID of the intended processed message is determined based on the second message ID of the historically processed message.
In this embodiment, S302 is the same as S102 in the first embodiment, and please refer to the related description of S102 in the first embodiment, which is not repeated herein.
Step S303: and if the message to be processed is an alarm message, judging whether the first message ID is the same as the third message ID.
It should be noted that, for the same alarm, the same alarm includes four messages, namely, an alarm activation message, an alarm mute message, an alarm non-mute message, and an alarm stop message, and the respective corresponding message states of the four messages are an alarm activation state, an alarm mute state, an alarm non-mute state, and an alarm stop state.
The alarm activation state refers to a state that the equipment detects an alarm and activates the alarm; the alarm mute state means that the equipment is forced to enter a non-alarm state; the alarm non-silent state means that the equipment is forced to enter an alarm state; the alarm stop state refers to a state in which an alarm is stopped.
It should be noted that, when the alarm stop message is read, if the device is currently in the alarm activation state, the message IDs are sequentially increased; if the device is in the alarm mute state or the alarm unmuted state, the message ID is not increased, but the ID corresponding to the alarm mute message or the alarm unmuted message is used as the ID of the alarm stop message, so that the alarm stop message can be preferentially processed, and the alarm mute message or the alarm unmuted message in front of the alarm stop message is ignored.
Step S304: and if the first message ID is the same as the third message ID, processing the message to be processed.
And if the first message ID is the same as the third message ID, which indicates that the message to be processed is the message expected to be processed, immediately processing the message to be processed.
Step S305: and if the first message ID is larger than the third message ID, the message is put back to the message queue, and the number of putting back times is recorded.
For example, if the third message ID is 1001 and the first message ID is 1002, it indicates that the message is out of order, and the pending message is not the message that the processor currently expects to process, so the pending message is ignored first, put back into the message queue, and record the number of times of putting back.
It should be noted that when the message to be processed is put back into the message queue, a delay is required to be set in order to prevent the message from being processed by other processors. The delay may be set according to actual needs, for example, the delay may be set to 3 seconds or 5 seconds, which is not limited.
Step S306: and when the number of the putting back times reaches a preset number, processing the message to be processed.
The preset number of times can be set as required, and is usually set to 3, that is, if the number of times of putting back reaches 3 times, the message to be processed is processed.
When the number of times of putting back the message to be processed reaches a preset number of times, the message to be processed needs to be processed. This is to take into account that if a message is stored in the message queue for a long time and cannot be processed normally, it may not be meaningful to process the message again later.
The processing mode of the message to be processed may be to ignore the message, that is, not to process the message, or may be other processing modes, and may be set according to actual needs, which is not limited herein.
Step S307: and acquiring a first time stamp of the message to be processed.
Wherein, the timestamp refers to a time point when a certain message is generated, and the first timestamp refers to a time point when the message to be processed is generated.
Step S308: and if the first timestamp is less than or equal to a second timestamp of the historical processing message, not processing the message to be processed.
When the first timestamp is less than or equal to the second message timestamp, it is indicated that the message to be processed has been processed before, that is, the message to be processed belongs to a repeated message, and therefore, the message to be processed does not need to be processed any more and can be ignored.
Illustratively, fig. 3a is a log table of processing of alarm messages, and fig. 3a shows a specific processing procedure of alarm messages. Fig. 3a includes message sequence, message name, timestamp, message ID, message type, whether to immediately process, whether to update status, and the number of times to replace.
First, a pending message, Msg3, is read from the message queue, as shown in the second row of fig. 3 a. Assume that a preset initial value is set to 1001, i.e., the message ID of the alarm message is numbered from 1001. Initially, the third message ID expected to process a message is 1001 since the message processing server has not previously processed any message. Therefore, since the first message ID is larger than the third message ID, Msg3 is put back into the message queue and the number of times it is put back is recorded.
The next message to be processed, Msg2, is then read from the message queue, as shown in the third row of fig. 3 a. At this point, the third message ID of the expected processing message is still 1001. Since the first message ID is greater than the third message ID, Msg2 is placed back into the message queue and its number of times placed back is recorded.
The next message to be processed, Msg1, is read from the message queue, as shown in the fourth row of fig. 3 a. At this time, since the third message ID of the expected processing message is 1001 and the first message ID is equal to the third message ID, Msg1 needs to be immediately processed, and thus the parameter values of both "whether to immediately process" and "whether to update the status" in the fourth row of fig. 3a are "Y".
The next message to be processed, i.e. the delayed Msg3, is read from the message queue, as shown in the fifth row of fig. 3 a. At this time, since the second message ID of the history processing message is 1001, the third message ID of the expected processing message is 1002. Since the first message ID is equal to the third message ID and therefore Msg3 needs to be processed immediately, the parameter values of both "whether to process immediately" and "whether to update the status" in the fifth row of fig. 3a are "Y".
Finally, the next message to be processed, i.e. the delayed Msg2, is read from the message queue, as shown in the sixth row of fig. 3 a. At this time, Msg2 is not processed because the second timestamp of the history processed message is 14:02:03 and the first timestamp corresponding to Msg2 is less than the second timestamp.
It should be noted that, when the to-be-processed message put back in the message queue is read again, if the to-be-processed message has already been processed or is ignored, the parameter of the item "number of times of putting back" corresponding to the to-be-processed message is cleared, as shown in the fifth line and the sixth line in fig. 3 a.
It should be noted that the message IDs corresponding to Msg2 and Msg3 in fig. 3a are both 1002, which is to allow the alarm-stop message Msg3 to be processed preferentially and omit the alarm-mute message Msg2 before the alarm-stop message Msg 3526.
After step S308 is performed, step S309 may also be performed: and judging whether the first message ID is equal to the preset initial value or not, and if the first message ID is equal to the preset initial value, acquiring the playback times of the message to be processed.
The message queue comprises a large number of messages, each message corresponds to a unique message ID, and the message IDs are numbered from a preset initial value according to an increasing sequence. The preset initial value may be set as needed, and may be set to 0 or 1001, for example.
However, due to the limitation of hardware, considering that the value of the message ID cannot be increased infinitely, for example, an 8-bit counter whose count range is 0 to 127, that is, the maximum count value of the counter can only reach 127, if 127 is exceeded, data overflow occurs, and the counter cannot work normally. In view of this, it is therefore necessary to reset the message ID, i.e., the current message ID to a preset initial value.
It should be noted that, the determination of whether the first message ID is equal to the preset initial value is to determine whether the message to be processed is an ID reset message. If the first message ID is equal to the preset initial value, the message to be processed is the ID reset message, but the message to be processed is not processed immediately as soon as the ID reset message is read, but is processed when the ID reset message reaches the preset times. Therefore, after determining that the message to be processed is the ID reset message, the number of times of putting back the message to be processed needs to be acquired, so as to enable the processor to determine whether to immediately process the message to be processed. The preset number is mentioned in step S306, and is usually set to 3.
Step S310: and if the number of the putting back times is equal to the preset number of times, correspondingly modifying the message ID corresponding to the message behind the message to be processed in the message queue based on the preset initial value.
When the message to be processed is an ID reset message and the number of times of putting back the ID reset message reaches the preset number, the ID reset message is immediately processed. And the processing mode is based on a preset initial value, and correspondingly modifying the message ID corresponding to the message behind the message to be processed in the message queue.
Illustratively, if the preset initial value is 0, the message IDs in the message queue gradually increase in order from 0. And if the first message ID of the message to be processed is also 0, indicating that the message to be processed is an ID reset message, and acquiring the number of times of putting back the ID reset message. And if the preset times is 3, immediately processing the message to be processed if the number of putting back the message to be processed is 3. The processing mode is that based on the preset initial value of 0, the message ID of the first message after the message to be processed in the message queue is modified to be 1, and the message ID of the second message after the message to be processed is modified to be 2.
In this embodiment, a message type of an alarm message is processed, a first message ID corresponding to the message to be processed is compared with a third message ID corresponding to an expected processing message, and when the first message ID and the third message ID are the same, the message to be processed is processed, so that the message to be processed is ensured to be a message expected to be processed by a message processing server currently, and a message disorder problem in a message processing process is avoided; and comparing a first time stamp corresponding to the message to be processed with a second time stamp corresponding to the history processing message to judge whether the message to be processed belongs to the repeated message, if the first time stamp is less than or equal to the second time stamp, the message to be processed is not processed, so that the message processing server does not process the repeated message again, and the message repetition problem in the message processing process is solved; in addition, whether the message to be processed is an ID reset message is judged, and when the ID reset message reaches a preset number of times, the message ID corresponding to the message behind the message to be processed in the message queue is correspondingly modified based on the preset initial value, so that the message processing server can normally work, and the problem of data overflow is avoided.
It should be understood that, the sequence numbers of the steps in the foregoing embodiments do not imply an execution sequence, and the execution sequence of each process should be determined by its function and inherent logic, and should not constitute any limitation to the implementation process of the embodiments of the present invention.
Example four:
referring to fig. 4, fig. 4 is a device for processing a message according to an embodiment of the present invention, where the device includes:
a message obtaining module 401, configured to obtain a to-be-processed message carrying a first message ID from a message queue;
a third message ID determining module 402, configured to determine a third message ID of a message expected to be processed according to the second message ID of the history processing message;
a message processing module 403, configured to process the message to be processed if the first message ID is the same as the third message ID.
Optionally, the message processing module 403 further includes: a first message status acquiring module 4031, a third message status determining module 4032 and a first message processing module 4033;
the first message status acquiring module 4031 is configured to acquire a first message status of the to-be-processed message if the to-be-processed message is a fault message;
a third message state determining module, configured to determine a third message state and a third message ID of the expected processing message according to the second message state and the second message ID of the historical processing message;
a first message processing module 4033, configured to process the message to be processed if the first message ID is the same as the third message ID and the first message status is the same as the third message status.
Optionally, the message processing module 403 further includes: a first determination module 4034 and a second message processing module 4035;
the first determining module 4034 is configured to determine whether the first message ID is the same as the third message ID if the message to be processed is an alarm message;
and the second message processing module is used for processing the message to be processed if the first message ID is the same as the third message ID.
Further, the apparatus further comprises:
a message returning module 404, configured to return the to-be-processed message to the message queue and record the number of times of returning if the first message ID is greater than the third message ID;
a third message processing module 405, configured to process the message to be processed when the number of playback times reaches a preset number;
a first timestamp obtaining module 406, configured to obtain a first timestamp of the message to be processed;
a message ignoring module 407, configured to not process the to-be-processed message if the first timestamp is less than or equal to a second timestamp of the history processing message;
a second determining module 408, configured to determine whether the first message ID is equal to the preset initial value, and if the first message ID is equal to the preset initial value, obtain the number of times of putting back the to-be-processed message;
a message ID modification module 409, configured to, if the number of times of putting back is equal to the preset number of times, correspondingly modify, based on the preset initial value, a message ID corresponding to a message in the message queue after the message to be processed.
Example five:
fig. 5 is a schematic diagram of a message processing server according to an embodiment of the present invention. As shown in fig. 5, the message processing server 5 of this embodiment includes: a processor 50, a memory 51 and a computer program 52, such as a message handling program, stored in said memory 51 and operable on said processor 50. The processor 50, when executing the computer program 52, implements the steps in the various message processing method embodiments described above, such as the steps 101 to 103 shown in fig. 1. Alternatively, the processor 50, when executing the computer program 52, implements the functions of the modules/units in the above-mentioned device embodiments, such as the functions of the modules 41 to 43 shown in fig. 4.
Illustratively, the computer program 52 may be partitioned into one or more modules/units that are stored in the memory 51 and executed by the processor 50 to implement the present invention. The one or more modules/units may be a series of computer program instruction segments capable of performing specific functions, which are used to describe the execution process of the computer program 52 in the message processing server 5. For example, the computer program 52 may be divided into a message acquisition module, a third message ID determination module, and a message processing module, and the specific functions of each module are as follows:
the message acquisition module is used for acquiring a message to be processed carrying a first message ID from the message queue;
a third message ID determining module, configured to determine a third message ID of an expected processed message according to the second message ID of the historical processed message;
and the message processing module is used for processing the message to be processed if the first message ID is the same as the third message ID.
The message processing device/message processing server 5 may be a computing device such as a desktop computer, a notebook computer, a palm computer, and a cloud server. The message processing device/message processing server may include, but is not limited to, a processor 50, a memory 51. It will be understood by those skilled in the art that fig. 5 is merely an example of a message processing apparatus/message processing server 5 and is not intended to be limiting of the message processing apparatus/message processing server 5, and may include more or fewer components than shown, or some components may be combined, or different components, e.g., the message processing apparatus/message processing server may also include input-output devices, network access devices, buses, etc.
The Processor 50 may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic, discrete hardware components, etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory 51 may be an internal storage unit of the message processing apparatus/message processing server 5, such as a hard disk or a memory of the message processing apparatus/message processing server 5. The memory 51 may also be an external storage device of the message processing apparatus/message processing server 5, such as a plug-in hard disk provided on the message processing apparatus/message processing server 5, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like. Further, the memory 51 may also include both an internal storage unit and an external storage device of the message processing apparatus/message processing server 5. The memory 51 is used for storing the computer programs and other programs and data required by the message processing apparatus/message processing server. The memory 51 may also be used to temporarily store data that has been output or is to be output.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-mentioned division of the functional units and modules is illustrated, and in practical applications, the above-mentioned function distribution may be performed by different functional units and modules according to needs, that is, the internal structure of the apparatus is divided into different functional units or modules to perform all or part of the above-mentioned functions. Each functional unit and module in the embodiments may be integrated in one processing unit, or each unit may exist alone physically, or two or more units are integrated in one unit, and the integrated unit may be implemented in a form of hardware, or in a form of software functional unit. In addition, specific names of the functional units and modules are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present application. The specific working processes of the units and modules in the system may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and reference may be made to the related descriptions of other embodiments for parts that are not described or illustrated in a certain embodiment.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
In the embodiments provided in the present invention, it should be understood that the disclosed apparatus/message processing server and method may be implemented in other ways. For example, the above-described apparatus/message processing server embodiments are merely illustrative, and for example, the division of the modules or units is only one logical division, and there may be other divisions when actually implemented, for example, multiple units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated modules/units, if implemented in the form of software functional units and sold or used as separate products, may be stored in a computer readable storage medium. Based on such understanding, all or part of the flow of the method according to the embodiments of the present invention may also be implemented by a computer program, which may be stored in a computer-readable storage medium, and when the computer program is executed by a processor, the steps of the method embodiments may be implemented. Wherein the computer program comprises computer program code, which may be in the form of source code, object code, an executable file or some intermediate form, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, usb disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM), Random Access Memory (RAM), electrical carrier wave signals, telecommunications signals, software distribution medium, and the like. It should be noted that the computer readable medium may contain content that is subject to appropriate increase or decrease as required by legislation and patent practice in jurisdictions, for example, in some jurisdictions, computer readable media does not include electrical carrier signals and telecommunications signals as is required by legislation and patent practice.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present invention, and not for limiting the same; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not substantially depart from the spirit and scope of the embodiments of the present invention, and are intended to be included within the scope of the present invention.

Claims (8)

1. A method of message processing, comprising:
acquiring a message to be processed carrying a first message ID from a message queue;
determining a third message ID of the expected processing message according to the second message ID of the historical processing message;
if the first message ID is the same as the third message ID, processing the message to be processed;
if the first message ID is larger than the third message ID, the message to be processed is placed back to the message queue, and the number of times of placement is recorded;
judging whether the first message ID is equal to a preset initial value or not, and if the first message ID is equal to the preset initial value, acquiring the number of times of putting back the message to be processed;
if the number of the putting back times is equal to the preset number of times, correspondingly modifying the message ID corresponding to the message behind the message to be processed in the message queue based on the preset initial value;
and each message in the message queue corresponds to a message ID, and the message ID is increased from the preset initial value.
2. The method of claim 1, wherein after determining a third message ID for an intended processed message based on the second message ID for the historically processed message, comprising:
if the message to be processed is a fault message, acquiring a first message state of the message to be processed;
determining a third message state and a third message ID of the expected processing message according to a second message state and the second message ID of the historical processing message;
and if the first message ID is the same as the third message ID and the first message state is the same as the third message state, processing the message to be processed.
3. The method of claim 1, wherein after determining a third message ID for an intended processed message based on the second message ID for the historically processed message, comprising:
if the message to be processed is an alarm message, judging whether the first message ID is the same as the third message ID;
and if the first message ID is the same as the third message ID, processing the message to be processed.
4. The method of claim 1, wherein the method further comprises:
and when the number of the putting back times reaches a preset number, processing the message to be processed.
5. The method of claim 4, wherein the method further comprises:
acquiring a first timestamp of the message to be processed;
and if the first timestamp is less than or equal to a second timestamp of the historical processing message, not processing the message to be processed.
6. An apparatus for message processing, comprising:
the message acquisition module is used for acquiring a message to be processed carrying a first message ID from the message queue;
a third message ID determining module, configured to determine a third message ID of an expected processed message according to the second message ID of the historical processed message;
the message processing module is used for processing the message to be processed if the first message ID is the same as the third message ID;
a message returning module, configured to return the to-be-processed message to the message queue and record the number of times of returning if the first message ID is greater than the third message ID;
the second judging module is used for judging whether the first message ID is equal to a preset initial value or not, and if the first message ID is equal to the preset initial value, the number of times of putting back the message to be processed is obtained;
a message ID modification module, configured to, if the number of times of putting back is equal to a preset number of times, correspondingly modify, based on the preset initial value, a message ID corresponding to a message located after the message to be processed in the message queue;
and each message in the message queue corresponds to a message ID, and the message ID is increased from the preset initial value.
7. A message processing server comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that the processor implements the steps of the method according to any of claims 1 to 5 when executing the computer program.
8. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 5.
CN201811332252.9A 2018-11-09 2018-11-09 Message processing method and device and message processing server Active CN109614246B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811332252.9A CN109614246B (en) 2018-11-09 2018-11-09 Message processing method and device and message processing server

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811332252.9A CN109614246B (en) 2018-11-09 2018-11-09 Message processing method and device and message processing server

Publications (2)

Publication Number Publication Date
CN109614246A CN109614246A (en) 2019-04-12
CN109614246B true CN109614246B (en) 2021-01-08

Family

ID=66004063

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811332252.9A Active CN109614246B (en) 2018-11-09 2018-11-09 Message processing method and device and message processing server

Country Status (1)

Country Link
CN (1) CN109614246B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110365601A (en) * 2019-06-27 2019-10-22 苏州科达科技股份有限公司 Message treatment method, device and electronic equipment for video conference control front end

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104717105B (en) * 2015-02-11 2018-07-13 西安航天自动化股份有限公司 A kind of industrial sensor network Data duplication detection method based on ISA100.11a standards

Also Published As

Publication number Publication date
CN109614246A (en) 2019-04-12

Similar Documents

Publication Publication Date Title
CN110765023B (en) Distributed system testing method and system based on chaos experiment
CN107547759B (en) Quality inspection method and device for customer service staff call
CN110750341A (en) Task scheduling method, device, system, terminal equipment and storage medium
US10289472B2 (en) Resource leak detection method, apparatus, and system
CN112035344A (en) Multi-scenario test method, device, equipment and computer readable storage medium
CN110851207B (en) State transition management method and device, electronic equipment and storage medium
CN110244963B (en) Data updating method and device and terminal equipment
CN109614246B (en) Message processing method and device and message processing server
CN108628712B (en) Application program testing method and terminal equipment
CN111953569B (en) State information reporting method, device, equipment and medium
CN111049883B (en) Data reading method, device and system of distributed table system
CN108536512B (en) Interface switching method and device and terminal equipment
CN108322542B (en) Data updating method, system, device and computer readable storage medium
CN114625502A (en) Word-throwing task processing method and device, storage medium and electronic equipment
CN112788551B (en) Message processing method and device, terminal equipment and storage medium
CN113873026A (en) Dynamic timeout response method, device, terminal equipment and storage medium
CN112835759A (en) Test data processing method and device, electronic equipment and storage medium
CN108959405B (en) Strong consistency reading method of data and terminal equipment
CN109614137B (en) Software version control method, device, equipment and medium
CN107885618B (en) Data monitoring method, device, equipment and storage medium based on network game
CN108334394B (en) Multi-language processing method and device for basic data of multi-language software system
CN109167668B (en) Message notification method, message notification device and terminal equipment
CN115604668B (en) Short message sending and pushing monitoring method, device, equipment and storage medium
CN112423144B (en) Multimedia resource exception handling method, device, equipment and storage medium
CN110162479B (en) Abnormal application detection method and device and terminal equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right

Effective date of registration: 20231228

Address after: 518000 Yingfei Haocheng Science Park, Guansheng 5th Road, Luhu Community, Guanhu Street, Longhua District, Shenzhen, Guangdong 1515

Patentee after: Shenzhen Infineon Information Co.,Ltd.

Address before: 3 / F, building H-3, East Industrial Zone, Huaqiaocheng, Nanshan District, Shenzhen, Guangdong 518000

Patentee before: SHENZHEN INFINOVA Ltd.

TR01 Transfer of patent right