Movatterモバイル変換


[0]ホーム

URL:


CN114428693A - Method and device for adjusting message priority, electronic equipment and storage medium - Google Patents

Method and device for adjusting message priority, electronic equipment and storage medium
Download PDF

Info

Publication number
CN114428693A
CN114428693ACN202210332814.XACN202210332814ACN114428693ACN 114428693 ACN114428693 ACN 114428693ACN 202210332814 ACN202210332814 ACN 202210332814ACN 114428693 ACN114428693 ACN 114428693A
Authority
CN
China
Prior art keywords
message
priority
consumer
messages
state coefficient
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.)
Pending
Application number
CN202210332814.XA
Other languages
Chinese (zh)
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.)
Ji Hua Laboratory
Original Assignee
Ji Hua Laboratory
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 Ji Hua LaboratoryfiledCriticalJi Hua Laboratory
Priority to CN202210332814.XApriorityCriticalpatent/CN114428693A/en
Publication of CN114428693ApublicationCriticalpatent/CN114428693A/en
Pendinglegal-statusCriticalCurrent

Links

Images

Classifications

Landscapes

Abstract

The application belongs to the technical field of communication, and discloses a method, a device, electronic equipment and a storage medium for adjusting message priority, wherein messages and working information sent by a message main body are acquired; acquiring a preset priority of the message; acquiring a working state coefficient according to the working information; placing the message in a first message queue; calculating the priority value of the message according to the preset priority of the message and the working state coefficient by the first consumer of the first message queue; placing, by a first consumer of the first message queue, the message into a corresponding second topic type of a second message queue based on the priority value; and consuming the message by the second consumer of the corresponding second theme type, so that the urgent message is responded in time, and the message processing efficiency is improved.

Description

Method and device for adjusting message priority, electronic equipment and storage medium
Technical Field
The present application relates to the field of communications technologies, and in particular, to a method and an apparatus for adjusting message priority, an electronic device, and a storage medium.
Background
Automated equipment such as agvs (automated Guided vehicles), robots or mechanical arms, etc. are increasingly applied to factories, warehouses, etc. as long as the automated equipment normally operates, a large amount of data (messages) are generated, and according to the limiting factors such as the size and cost of the automated equipment, the data (messages) generated by the automated equipment generally need to be sent to a server of a control system, and further operation instructions are obtained by using the powerful computing power of the server.
Generally, the priority of the message is preset in the control system, so that the automation equipment executes the message one by one according to the size of the priority of the message, and since the priority of the message is preset in the system, the priority of the message is not changed generally, but in practical application, because some message sending subjects perform key operation or are in key positions on the road, the message sent by the subjects may need to be processed preferentially, such as a mechanical arm which is executing a welding task, the message sent during the task execution should be processed preferentially, the message sent when an AGV carrying goods for transportation passes through a road surface with uneven potholes, an uphill road section and a road intersection should be paid attention to, but the current priority setting mechanism of the message does not consider the situation, so that an emergency message response is easy to occur and the production scheduling is influenced.
Disclosure of Invention
The application aims to provide a method, a device, electronic equipment and a storage medium for adjusting message priority, so that an emergency message can be responded in time, and the message processing efficiency is improved.
In a first aspect, the present application provides a method for adjusting message priority, including the steps of:
A1. acquiring a message and working information sent by a message main body;
A2. acquiring a preset priority of the message;
A3. acquiring a working state coefficient according to the working information;
A4. placing the message in a first message queue;
A5. calculating the priority value of the message according to the preset priority of the message and the working state coefficient by the first consumer of the first message queue;
A6. placing, by a first consumer of the first message queue, the message into a corresponding second topic type of a second message queue based on the priority value;
A7. and consuming the message by a second consumer of the corresponding second topic type.
According to the method for adjusting the message priority, the first consumer of the first message queue calculates the priority value of the message according to the preset priority and the working state coefficient of the message, and the first consumer readjusts the priority value of the message according to the priority value, so that the situation that some messages sent by message main bodies during key operation need to be processed preferentially but cannot be processed in time is avoided, and therefore the urgent messages can be responded in time; the messages are put into the corresponding second theme type of the second message queue according to the priority values through the first consumer of the first message queue, the messages are consumed through the corresponding second consumer of the second theme type, for different second theme types, the messages in the second theme type are respectively consumed by different second consumers, the consumption processes of the messages in different second theme types are not influenced mutually, the messages with high priority values and the messages with low priority values are put into different second theme types, so that the processing process of the messages with low priority values cannot influence the processing process of the messages with high priority values, the processing process of the messages with high priority values cannot influence the processing process of the messages with low priority values, the urgent messages are ensured to be responded in time, and meanwhile, the waiting time of the non-urgent messages can be avoided, the efficiency of message processing is improved.
Preferably, step a2 includes:
determining a type of the message;
and acquiring the corresponding preset priority according to the type of the message.
Preferably, the working information includes location information and status information;
step a3 includes:
acquiring a first state coefficient according to the position information;
acquiring a second state coefficient according to the state information;
and calculating the working state coefficient according to the first state coefficient and the second state coefficient.
According to the method and the device, the current working state coefficient of the message body is obtained through comprehensive calculation according to the position and the state of the message body, the priority of the message is adjusted by utilizing the working state coefficient, the priority can be reasonably adjusted, and further the information needing to be processed preferentially can be responded in time.
Preferably, step a5 includes:
and calculating the product of the preset priority of the message and the working state coefficient by the first consumer of the first message queue to obtain the priority value.
The priority value is obtained by calculating the product of the preset priority of the message and the working state coefficient, and the priority of the message is adjusted according to the priority value.
Preferably, step a4 includes:
placing the message into a corresponding first theme type of the first message queue according to the preset priority;
step a5 includes:
calculating the priority value of the message according to the preset priority of the message and the working state coefficient by the first consumer of the corresponding first theme type;
step a6 includes:
placing, by the first consumer of the corresponding first topic type, the message into the corresponding second topic type of the second message queue according to the priority value.
The method comprises the steps of putting messages into corresponding first theme types of a first message queue according to preset priority, respectively consuming the messages in the first theme types by different first consumers for different first theme types, wherein the consumption processes of the messages in the different first theme types are not influenced by each other, and the messages with high preset priority and the messages with low preset priority are put into the different first theme types, so that the processing process of the messages with low preset priority cannot influence the processing process of the messages with high preset priority, and the processing process of the messages with high preset priority cannot influence the processing process of the messages with low preset priority, so that the messages with high preset priority can be processed in time, generally, the probability that the adjusted priority value of the messages with high preset priority is higher than the adjusted priority value of the messages with low preset priority is higher, therefore, the messages with different preset priorities are put into different first theme types for parallel processing, and the messages needing to be processed preferentially can be processed in time.
Preferably, the second message queue comprises a plurality of different second topic types, each of the second topic types corresponding to a different priority value range;
step a6 includes:
and the first consumer through the first message queue puts the message into the corresponding second theme type of the second message queue according to the range of the priority value.
Preferably, step a7 includes:
consuming the message by one of the second consumers of the corresponding second topic type.
In a second aspect, the present application provides an apparatus for adjusting message priority, comprising:
the first acquisition module is used for acquiring the message and the working information sent by the message main body;
the second acquisition module is used for acquiring the preset priority of the message;
the third acquisition module is used for acquiring a working state coefficient according to the working information;
a first processing module for placing said message in a first message queue;
the calculation module is used for calculating the priority value of the message according to the preset priority of the message and the working state coefficient through the first consumer of the first message queue;
a second processing module for placing, by the first consumer of the first message queue, the message into a corresponding second topic type of a second message queue according to the priority value;
and the execution module is used for consuming the message through the second consumer of the corresponding second theme type.
According to the device for adjusting the message priority, the first consumer of the first message queue calculates the priority value of the message according to the preset priority and the working state coefficient of the message, and the first consumer readjusts the priority value of the message according to the priority value, so that the situation that some messages sent by message main bodies during key operation need to be processed preferentially but cannot be processed in time is avoided, and therefore the urgent messages can be responded in time; the messages are put into the corresponding second theme type of the second message queue according to the priority values through the first consumer of the first message queue, the messages are consumed through the corresponding second consumer of the second theme type, for different second theme types, the messages in the second theme type are consumed by different second consumers respectively, the consumption processes of the messages in different second theme types are not influenced mutually, the messages with high priority values and the messages with low priority values can be put into different second theme types, therefore, the processing process of the messages with low priority values can not influence the processing process of the messages with high priority values, the processing process of the messages with high priority values can not influence the processing process of the messages with low priority values, thereby ensuring that the urgent messages can be responded in time and avoiding the waiting time of non-urgent messages, the efficiency of message processing is improved.
In a third aspect, the present application provides an electronic device comprising a processor and a memory, wherein the memory stores a computer program executable by the processor, and the processor executes the computer program to perform the steps of the method for adjusting message priority as described above.
In a fourth aspect, the present application provides a computer storage medium having stored thereon a computer program which, when executed by a processor, performs the steps in the method of adjusting message priority as described above.
Has the advantages that:
according to the method, the device, the electronic equipment and the storage medium for adjusting the message priority, the message and the working information sent by the message main body are obtained; acquiring a preset priority of the message; acquiring a working state coefficient according to the working information; placing the message in a first message queue; calculating the priority value of the message according to the preset priority of the message and the working state coefficient by the first consumer of the first message queue; placing, by a first consumer of the first message queue, the message into a corresponding second topic type of a second message queue based on the priority value; consuming the message by a second consumer of the corresponding second topic type; the urgent message is responded in time, and the message processing efficiency is improved.
Additional features and advantages of the application will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by the practice of the application.
Drawings
Fig. 1 is a flowchart of a method for adjusting message priority provided by the present application.
Fig. 2 is a schematic structural diagram of an apparatus for adjusting message priority provided in the present application.
Fig. 3 is a schematic structural diagram of an electronic device provided in the present application.
1, a first acquisition module; 2. a second acquisition module; 3. a third obtaining module; 4. a first processing module; 5. a calculation module; 6. a second processing module; 7. an execution module; 301. a processor; 302. a memory; 303. a communication bus.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. The components of the embodiments of the present application, generally described and illustrated in the figures herein, can be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the present application, presented in the accompanying drawings, is not intended to limit the scope of the claimed application, but is merely representative of selected embodiments of the application. All other embodiments, which can be derived by a person skilled in the art from the embodiments of the present application without making any creative effort, shall fall within the protection scope of the present application.
It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures. Meanwhile, in the description of the present application, the terms "first", "second", and the like are used only for distinguishing the description, and are not to be construed as indicating or implying relative importance.
Since the priority of the message is preset in the control system, the message will not change normally, but in practical application, some message bodies cannot be processed in time when the message sent during the critical operation needs to be processed preferentially.
Referring to fig. 1, fig. 1 is a method for adjusting message priority according to the present application, where the method for adjusting message priority includes the steps of:
A1. acquiring a message and working information sent by a message main body;
A2. acquiring a preset priority of a message;
A3. acquiring a working state coefficient according to the working information;
A4. placing the message in a first message queue;
A5. calculating a priority value of the message according to the preset priority and the working state coefficient of the message by a first consumer of the first message queue;
A6. placing, by the first consumer of the first message queue, the message into the corresponding second topic type of the second message queue according to the priority value;
A7. the message is consumed by a second consumer of the corresponding second topic type.
According to the method for adjusting the message priority, the first consumer of the first message queue calculates the priority value of the message according to the preset priority and the working state coefficient of the message, and the first consumer readjusts the priority value of the message according to the priority value, so that the situation that some messages sent by message main bodies during key operation need to be processed preferentially but cannot be processed in time is avoided, and therefore the urgent messages can be responded in time; the messages are put into the corresponding second theme type of the second message queue according to the priority values through the first consumer of the first message queue, the messages are consumed through the corresponding second consumer of the second theme type, for different second theme types, the messages in the second theme type are respectively consumed by different second consumers, the consumption processes of the messages in different second theme types are not influenced mutually, the messages with high priority values and the messages with low priority values are put into different second theme types, so that the processing process of the messages with low priority values cannot influence the processing process of the messages with high priority values, the processing process of the messages with high priority values cannot influence the processing process of the messages with low priority values, the urgent messages are ensured to be responded in time, and meanwhile, the waiting time of the non-urgent messages can be avoided, the efficiency of message processing is improved.
Specifically, the message body is a device for sending a message, and may be an automated device such as an AGV transport vehicle, a robot arm, or a robot.
Specifically, the preset priority may be set in advance for different messages according to the type of the message body and the type of the message itself, or only according to the type of the message itself, and the specific setting rule may be set according to actual needs, which is not limited herein. The preset priority may represent a processing level or an emergency degree of the message, and may be represented by an arabic number, a letter, or another symbol, in this embodiment, the preset priority is preferably represented by an arabic number, which is convenient for calculation, wherein the higher the preset priority is, the larger the corresponding arabic number is; for example, the preset priority of the alarm message of the mechanical arm is set to 10, while the priority of the mechanical arm activation message is set to 1, and the like, the preset priority of the specific message may set a corresponding priority value according to the urgency of the message, which is not limited thereto.
In practical application, the priority of the general message is preset, the message is processed according to the preset priority in the using process, but this does not take into account the environment in which the message body is located, when the message body is in a critical location or critical state, the message sent by the message body needs to be processed preferentially, which results in that the message needing to be processed preferentially is not processed in time, and therefore, in the present example, it is considered that the work information of the message body, such as the state information of the work, the location information and the like, and setting a corresponding working state coefficient according to the working state and the working position of the message main body, and further determining the priority value of the message sent by the message main body according to the preset priority level and the working state coefficient of the message, so that the emergency message sent in a key state is prevented from being processed in time.
Specifically, the messages are placed in a first message queue, a first consumer of the first message queue calculates the priority value of the messages according to the priority level and the working state coefficient of the messages, the first consumer readjusts the priority level of the messages according to the priority value, the messages are placed in a corresponding second theme type of a second message queue, and the second consumer of the corresponding second theme type consumes the messages, so that the messages with higher priority levels are responded in time.
It should be understood that the first Consumer and the second Consumer are both consumers of the message, are outlets of the message (see concumer in Kafka messaging system), and the first topic type and the second topic type are categories of published records or feed names (see topic in Kafka messaging system).
In some embodiments, step a2 includes:
determining the type of the message;
and acquiring the corresponding preset priority according to the type of the message.
Specifically, the type of the message may include a start message, an alarm message, a standby message, a shutdown message, or the like, and is not particularly limited thereto.
Specifically, corresponding type codes can be set for different types of messages in advance, and the message body includes the corresponding type codes in the message when sending the message, so that the type of the message can be determined by extracting the type codes.
In practical application, a preset priority look-up table can be formed according to the mapping relation between different types of codes and corresponding preset priorities, so that the step of acquiring the corresponding preset priorities according to the types comprises the following steps: and inquiring in a preset priority inquiry table according to the type code of the message to obtain the corresponding preset priority.
In other embodiments, a corresponding preset priority lookup table may be set for different message bodies according to identity information (e.g., ip information) of the different message bodies, and the step of obtaining the corresponding preset priority according to the type includes: and extracting a corresponding preset priority query table according to the identity information of the message body, and querying in the preset priority query table according to the type code of the message to obtain the corresponding preset priority.
In some embodiments, the operational information includes location information and status information;
step a3 includes:
acquiring a first state coefficient according to the position information;
acquiring a second state coefficient according to the state information;
and calculating the working state coefficient according to the first state coefficient and the second state coefficient.
In practical applications, the operation information may include position information and state information, or other information related to the operation, and is not particularly limited thereto, the position information may be position type information of a position where the message body is located, for example, a road surface with uneven pits, an uphill road section, a road intersection, a straight road section, and the like, corresponding first state coefficients may be allocated to different position types in advance, for example, the first state coefficient of the straight road section may be set to 1, the first state coefficient of the uphill road section may be set to 6, the first state coefficient of the road intersection may be set to 8, and the like, and may be set according to actual needs. The state information can be emergency state information or non-emergency state information, the emergency state and the non-emergency state can be divided according to actual needs, and a second state coefficient corresponding to the emergency state information can be set to be a numerical value larger than or equal to 1; and the second state coefficient corresponding to the non-emergency state information is set to a value greater than 0 and smaller than 1, which is not limited to this.
Specifically, if the first state coefficient is 8 and the second state coefficient is 2, the product may be calculated according to the first state coefficient and the second state coefficient to obtain the working state coefficient, that is, 8 × 2= 16; the operating state coefficient may also be obtained by calculating the sum of the first state coefficient and the second state coefficient, that is, 8+2=10, and in this embodiment, it is preferable to calculate the product according to the first state coefficient and the second state coefficient, so as to obtain the operating state coefficient, which is not limited to this.
In some embodiments, step a5 includes:
and calculating the product of the preset priority of the message and the working state coefficient by the first consumer of the first message queue to obtain a priority value.
Specifically, after the working state coefficient is obtained, the latest priority of the message is calculated comprehensively according to the preset priority of the message, the product or the sum of the preset priority and the working state coefficient may be adopted, the product is preferably adopted as the priority value in the embodiment, and the first consumer readjusts the priority of the message according to the size of the priority value, so that the message needing to be processed in priority is processed in time.
The messages can be sequentially placed into the first message queue for queuing according to the message sending time sequence, and the first consumer of the first message queue sequentially processes the messages according to the queuing sequence.
In some preferred embodiments, step a4 includes:
placing the messages into a corresponding first theme type of a first message queue according to a preset priority;
step a5 includes:
calculating a priority value of the message according to the preset priority and the working state coefficient of the message by the corresponding first consumer of the first theme type;
step a6 includes:
the messages are placed in the corresponding second topic type of the second message queue according to the priority values by the first consumer of the corresponding first topic type.
In practical application, the messages are put into the corresponding first theme types of the first message queue according to the preset priority, for different first theme types, the messages in the first theme types are respectively consumed by different first consumers, the consumption processes of the messages in the different first theme types are not influenced mutually, the messages with high preset priority and the messages with low preset priority are put into the different first theme types, so that the processing process of the messages with low preset priority does not influence the processing process of the messages with high preset priority, and the processing process of the messages with high preset priority does not influence the processing process of the messages with low preset priority, so that the messages with high preset priority can be processed in time, generally, the probability that the adjusted priority value of the messages with high preset priority is higher than the adjusted priority value of the messages with low preset priority is higher, therefore, the messages with different preset priorities are put into different first theme types for parallel processing, and the messages needing to be processed preferentially can be processed in time.
It should be understood that the message may be placed in the corresponding first topic type according to the urgency of the message, and the parallel processing may be performed, so that the urgent message and the non-urgent message are not affected by each other. Each first topic type corresponds to a different preset priority range, so that the step of placing the message into the corresponding first topic type of the first message queue according to the preset priority comprises the following steps: and placing the messages into the corresponding first theme type of the first message queue according to the range of the preset priority.
Preferably, in the first message queue, each first topic type is provided with a plurality of first consumers correspondingly, and the plurality of first consumers are used for processing a plurality of messages in the same first topic type in parallel, so as to improve the processing efficiency. Therefore, the step of calculating the priority value of the message according to the preset priority and the working state coefficient of the message by the first consumer of the corresponding first theme type comprises the following steps: and calculating the priority value of the message according to the preset priority and the working state coefficient of the message by one of the first consumers of the corresponding first theme type.
In some embodiments, the second message queue comprises a plurality of different second topic types, each second topic type corresponding to a different range of priority values;
step a6 includes:
the first consumer via the first message queue places the message in the corresponding second topic type in the second message queue based on the range of priority values.
Specifically, the second message queue includes a plurality of different second topic types, each second topic type corresponds to a different priority value range, for example, a first consumer places a message with a priority value range of 8-10 (excluding 8, including 10, which can be set according to actual needs, and is not limited here) in a first second topic type, and places a message with a priority value range of 6-8 (excluding 6, including 8, which can be set according to actual needs, and is not limited here) in a second topic type, so that messages with similar urgency degrees can be consumed by a second consumer in the same topic type, thereby improving the processing efficiency of the message.
It should be understood that, according to the specific range of the urgency degree of the message, the message is put into the corresponding second topic type for parallel processing, so that the urgent message and the non-urgent message are not affected by each other.
Preferably, in the second message queue, each second topic type is correspondingly provided with a plurality of second consumers, and the plurality of second consumers are used for processing a plurality of messages in the same second topic type in parallel, so as to improve the processing efficiency. Thus, step a7 includes:
the message is consumed by one of a plurality of second consumers of a corresponding second topic type.
Specifically, the message is consumed by one of the second consumers of the corresponding second topic type, and the step of dynamically calculating the priority value is added, so that the processing speed may be affected, and therefore, the second consumers are added to process a plurality of messages in the same second topic type in parallel, and the processing speed is further improved.
In view of the above, the method for adjusting the priority of the message provided by the present application obtains the message and the working information sent by the message body; acquiring a preset priority of a message; acquiring a working state coefficient according to the working information; placing the message in a first message queue; calculating a priority value of the message according to the preset priority and the working state coefficient of the message by a first consumer of the first message queue; placing, by the first consumer of the first message queue, the message into the corresponding second topic type of the second message queue according to the priority value; consuming the message by a second consumer of the corresponding second topic type; the urgent message is responded in time, and the message processing efficiency is improved.
Referring to fig. 2, the present application provides an apparatus for adjusting message priority, including:
the first acquisition module 1 is used for acquiring the message and the working information sent by the message main body;
the second obtainingmodule 2 is used for obtaining the preset priority of the message;
the third obtainingmodule 3 is used for obtaining the working state coefficient according to the working information;
a first processing module 4, for placing the message into a first message queue;
thecalculation module 5 is used for calculating the priority value of the message according to the preset priority and the working state coefficient of the message by the first consumer of the first message queue;
asecond processing module 6, configured to place, by the first consumer in the first message queue, the message into a corresponding second topic type in a second message queue according to the priority value;
and theexecution module 7 is used for consuming the message by the second consumer of the corresponding second theme type.
According to the device for adjusting the message priority, the first consumer of the first message queue calculates the priority value of the message according to the preset priority and the working state coefficient of the message, and the first consumer readjusts the priority value of the message according to the priority value, so that the situation that some messages sent when key operation is carried out on message main bodies need to be processed preferentially but cannot be processed in time is avoided, and therefore the urgent message can be responded in time; the messages are put into the corresponding second theme type of the second message queue according to the priority values through the first consumer of the first message queue, the messages are consumed through the corresponding second consumer of the second theme type, for different second theme types, the messages in the second theme type are respectively consumed by different second consumers, the consumption processes of the messages in different second theme types are not influenced mutually, the messages with high priority values and the messages with low priority values are put into different second theme types, so that the processing process of the messages with low priority values cannot influence the processing process of the messages with high priority values, the processing process of the messages with high priority values cannot influence the processing process of the messages with low priority values, the urgent messages are ensured to be responded in time, and meanwhile, the waiting time of the non-urgent messages can be avoided, the efficiency of message processing is improved.
Specifically, the message body is a device for sending a message, and may be an automated device such as an AGV transport vehicle, a robot arm, or a robot.
Specifically, the preset priority may be set in advance for different messages according to the type of the message body and the type of the message itself, or only according to the type of the message itself, and the specific setting rule may be set according to actual needs, which is not limited herein. The preset priority may represent a processing level or an emergency degree of the message, and may be represented by an arabic number, a letter, or another symbol, in this embodiment, the preset priority is preferably represented by an arabic number, which is convenient for calculation, wherein the higher the preset priority is, the larger the corresponding arabic number is; for example, the preset priority of the alarm message of the mechanical arm is set to 10, while the priority of the mechanical arm activation message is set to 1, and the like, the preset priority of the specific message may set a corresponding priority value according to the urgency of the message, which is not limited thereto.
In practical application, the priority of the common message is preset, the message is processed according to the preset priority in the using process, but this does not take into account the environment in which the message body is located, when the message body is in a critical location or critical state, the message sent by the message body needs to be processed preferentially, which results in that the message needing to be processed preferentially is not processed in time, and therefore, in the present example, it is considered that the work information of the message body, such as the state information of the work, the location information and the like, and setting a corresponding working state coefficient according to the working state and the working position of the message main body, and further determining the priority value of the message to be sent according to the preset priority and the working state coefficient of the message to avoid that the emergency message sent in a key state is not processed in time.
Specifically, the messages are placed in a first message queue, a first consumer of the first message queue calculates the priority value of the messages according to the priority level and the working state coefficient of the messages, the first consumer readjusts the priority level of the messages according to the priority value, the messages are placed in a corresponding second theme type of a second message queue, and the second consumer of the corresponding second theme type consumes the messages, so that the messages with higher priority levels are responded in time.
It should be understood that the first Consumer and the second Consumer are both consumers of the message, are outlets of the message (see concumer in Kafka messaging system), and the first topic type and the second topic type are categories of published records or feed names (see topic in Kafka messaging system).
In some embodiments, the second obtainingmodule 2 specifically executes, when obtaining the preset priority of the message:
determining the type of the message;
and acquiring the corresponding preset priority according to the type of the message.
Specifically, the type of the message includes a start message, an alarm message, a standby message, a shutdown message, or the like, and is not particularly limited thereto.
Specifically, corresponding type codes can be set for different types of messages in advance, and when the message body sends the message, the corresponding type codes are contained in the message, so that the type of the message can be determined by extracting the type codes.
In practical application, a preset priority query table can be formed according to the mapping relationship between different types of codes and corresponding preset priorities, so that the second obtainingmodule 2 specifically executes the following steps when obtaining the corresponding preset priorities according to the types: and inquiring in a preset priority inquiry table according to the type code of the message to obtain the corresponding preset priority.
In other embodiments, a corresponding preset priority query table may be set for different message bodies according to identity information (e.g., ip information) of the different message bodies, so that the second obtainingmodule 2 specifically performs, when obtaining a corresponding preset priority according to the type: and extracting a corresponding preset priority query table according to the identity information of the message body, and querying in the preset priority query table according to the type code of the message to obtain the corresponding preset priority.
In some embodiments, the operational information includes location information and status information;
the third obtainingmodule 3 specifically executes the following steps when obtaining the working state coefficient according to the working information:
acquiring a first state coefficient according to the position information;
acquiring a second state coefficient according to the state information;
and calculating the working state coefficient according to the first state coefficient and the second state coefficient.
In practical applications, the operation information may include position information and state information, or other information related to the operation, and is not particularly limited thereto, the position information may be position type information of a position where the message body is located, for example, a road surface with uneven pits, an uphill road section, a road intersection, a straight road section, and the like, corresponding first state coefficients may be allocated to different position types in advance, for example, the first state coefficient of the straight road section may be set to 1, the first state coefficient of the uphill road section may be set to 6, the first state coefficient of the road intersection may be set to 8, and the like, and may be set according to actual needs. The state information can be emergency state information or non-emergency state information, the emergency state and the non-emergency state can be divided according to actual needs, and a second state coefficient corresponding to the emergency state information can be set to be a numerical value larger than or equal to 1; and the second state coefficient corresponding to the non-emergency state information is set to a value greater than 0 and smaller than 1, which is not limited to this.
Specifically, if the first state coefficient is 8 and the second state coefficient is 2, the product may be calculated according to the first state coefficient and the second state coefficient to obtain the working state coefficient, that is, 8 × 2= 16; the operating state coefficient may also be obtained by calculating the sum of the first state coefficient and the second state coefficient, that is, 8+2=10, and the embodiment preferably calculates the product of the first state coefficient and the second state coefficient to obtain the operating state coefficient, which is not limited to this.
In some embodiments, when the first consumer who passes through the first message queue calculates the priority value of the message according to the preset priority and the working state coefficient of the message, the calculatingmodule 5 specifically performs:
and calculating the product of the preset priority of the message and the working state coefficient by the first consumer of the first message queue to obtain a priority value.
Specifically, after the working state coefficient is obtained, the latest priority of the message is calculated comprehensively according to the preset priority of the message, the product or the sum of the preset priority and the working state coefficient may be adopted, the product is preferably adopted as the priority value in the embodiment, and the first consumer readjusts the priority of the message according to the size of the priority value, so that the message needing to be processed in priority is processed in time.
The messages can be sequentially placed into the first message queue for queuing according to the message sending time sequence, and the first consumers of the first message queue sequentially process the messages according to the queuing sequence.
In some preferred embodiments, the first processing module 4 specifically performs, when placing a message into the first message queue:
placing the messages into a corresponding first theme type of a first message queue according to a preset priority;
when the first consumer who passes through the first message queue calculates the priority value of the message according to the preset priority and the working state coefficient of the message, thecalculation module 5 specifically executes:
calculating a priority value of the message according to the preset priority and the working state coefficient of the message by the corresponding first consumer of the first theme type;
thesecond processing module 6 specifically executes, when the first consumer who has passed through the first message queue puts the message into the corresponding second topic type of the second message queue according to the priority value:
the messages are placed in the corresponding second topic type of the second message queue according to the priority values by the first consumer of the corresponding first topic type.
In practical application, the messages are put into the corresponding first theme types of the first message queue according to the preset priority, for different first theme types, the messages in the first theme types are respectively consumed by different first consumers, the consumption processes of the messages in the different first theme types are not influenced mutually, the messages with high preset priority and the messages with low preset priority are put into the different first theme types, so that the processing process of the messages with low preset priority does not influence the processing process of the messages with high preset priority, and the processing process of the messages with high preset priority does not influence the processing process of the messages with low preset priority, so that the messages with high preset priority can be processed in time, generally, the probability that the adjusted priority value of the messages with high preset priority is higher than the adjusted priority value of the messages with low preset priority is higher, therefore, the messages with different preset priorities are put into different first theme types for parallel processing, and the messages needing to be processed preferentially can be processed in time.
It should be understood that the message may be placed in the corresponding first topic type according to the urgency of the message, and the parallel processing may be performed, so that the urgent message and the non-urgent message are not affected by each other. Each first topic type corresponds to a different preset priority range, so that when the first processing module 4 puts the message into the corresponding first topic type of the first message queue according to the preset priority, the following specific steps are executed: and placing the messages into the corresponding first theme type of the first message queue according to the range of the preset priority.
Preferably, in the first message queue, each first topic type is provided with a plurality of first consumers correspondingly, and the plurality of first consumers are used for processing a plurality of messages in the same first topic type in parallel, so as to improve the processing efficiency. Therefore, when the calculatingmodule 5 calculates the priority value of the message according to the preset priority and the working state coefficient of the message by the first consumer of the corresponding first topic type, the following steps are specifically executed: and calculating the priority value of the message according to the preset priority and the working state coefficient of the message by one of the first consumers of the corresponding first theme type.
In some embodiments, the second message queue comprises a plurality of different second topic types, each second topic type corresponding to a different range of priority values;
thesecond processing module 6 specifically executes, when the first consumer who has passed through the first message queue puts the message into the corresponding second topic type of the second message queue according to the priority value:
the first consumer via the first message queue places the message in the corresponding second topic type in the second message queue based on the range of priority values.
Specifically, the second message queue includes a plurality of different second topic types, each second topic type corresponds to a different priority value range, for example, a first consumer places a message with a priority value range of 8-10 (excluding 8, including 10, which can be set according to actual needs, and is not limited here) in a first second topic type, and places a message with a priority value range of 6-8 (excluding 6, including 8, which can be set according to actual needs, and is not limited here) in a second topic type, so that messages with similar urgency degrees can be consumed by a second consumer in the same topic type, thereby improving the processing efficiency of the message.
It should be understood that, according to the specific range of the urgency degree of the message, the message is put into the corresponding second topic type for parallel processing, so that the urgent message and the non-urgent message are not affected.
Preferably, in the second message queue, each second topic type is correspondingly provided with a plurality of second consumers, and the plurality of second consumers are used for processing a plurality of messages in the same second topic type in parallel, so as to improve the processing efficiency. Thus, when consuming the message by the second consumer of the corresponding second topic type, theexecution module 7 specifically executes:
the message is consumed by one of a plurality of second consumers of a corresponding second topic type.
Specifically, the message is consumed by one of the second consumers of the corresponding second topic type, and the step of dynamically calculating the priority value is added, so that the processing speed may be affected, and therefore, the second consumers are added to process a plurality of messages in the same second topic type in parallel, and the processing speed is further improved.
According to the device for adjusting the message priority, the first consumer of the first message queue calculates the priority value of the message according to the preset priority and the working state coefficient of the message, and the first consumer readjusts the priority value of the message according to the priority value, so that the messages sent by some message main bodies during key operation are prevented from being preferentially processed but not processed, and therefore the urgent messages are made to respond in time; and the first consumer of the first message queue puts the message into the corresponding second theme type of the second message queue according to the priority value, and the second consumer of the corresponding second theme type consumes the message, so that the message processing efficiency is improved.
Referring to fig. 3, fig. 3 is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure, where the present disclosure provides an electronic device, including: theprocessor 301 and thememory 302, theprocessor 301 and thememory 302 being interconnected and communicating with each other via acommunication bus 303 and/or other form of connection mechanism (not shown), thememory 302 storing a computer program executable by theprocessor 301, theprocessor 301 executing the computer program when the electronic device is running to perform the method for adjusting message priority in any of the alternative implementations of the above embodiments to implement the following functions: acquiring a message and working information sent by a message main body; acquiring a preset priority of a message; acquiring a working state coefficient according to the working information; placing the message in a first message queue; calculating a priority value of the message according to the preset priority and the working state coefficient of the message by a first consumer of the first message queue; and the first consumer of the first message queue puts the message into the corresponding second theme type of the second message queue according to the priority value, and the second consumer of the corresponding second theme type consumes the message.
The embodiment of the present application provides a computer storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the computer program executes a method for adjusting message priority in any optional implementation manner of the foregoing embodiment, so as to implement the following functions: acquiring a message and working information sent by a message main body; acquiring a preset priority of a message; acquiring a working state coefficient according to the working information; placing the message in a first message queue; calculating a priority value of the message according to the preset priority and the working state coefficient of the message by a first consumer of the first message queue; and the first consumer of the first message queue puts the message into the corresponding second theme type of the second message queue according to the priority value, and the second consumer of the corresponding second theme type consumes the message. The computer storage medium may be implemented by any type of volatile or nonvolatile storage device or combination thereof, such as a Static Random Access Memory (SRAM), an Electrically Erasable Programmable Read-Only Memory (EEPROM), an Erasable Programmable Read-Only Memory (EPROM), a Programmable Read-Only Memory (PROM), a Read-Only Memory (ROM), a magnetic Memory, a flash Memory, a magnetic disk, or an optical disk.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. The above-described embodiments of the apparatus are merely illustrative, and for example, a division of a unit is merely a division of one logic function, and there may be other divisions when actually implemented, and for example, a plurality of 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 of devices or units through some communication interfaces, and may be in an electrical, mechanical or other form.
In addition, 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 modules in the embodiments of the present application may be integrated together to form an independent part, or each module may exist alone, or two or more modules may be integrated to form an independent part.
In this document, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions.
The above description is only an example of the present application and is not intended to limit the scope of the present application, and various modifications and changes may be made to the present application by those skilled in the art. Any modification, equivalent replacement, improvement and the like made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims (10)

Translated fromChinese
1.一种调节消息优先级的方法,其特征在于,包括步骤:1. a method for adjusting message priority, is characterized in that, comprises the steps:A1.获取消息主体发送的消息和工作信息;A1. Obtain the message and work information sent by the message body;A2.获取所述消息的预设优先级;A2. Obtain the preset priority of the message;A3.根据所述工作信息获取工作状态系数;A3. Obtain the working status coefficient according to the working information;A4.把所述消息放入第一个消息队列;A4. Put the message into the first message queue;A5.通过所述第一个消息队列的第一消费者,根据所述消息的预设优先级和所述工作状态系数计算所述消息的优先值;A5. Calculate the priority value of the message according to the preset priority of the message and the working state coefficient through the first consumer of the first message queue;A6.通过所述第一个消息队列的第一消费者,根据所述优先值把所述消息放入第二个消息队列的对应的第二主题类型中;A6. Put the message into the corresponding second topic type of the second message queue according to the priority value through the first consumer of the first message queue;A7.通过所述对应的第二主题类型的第二消费者对所述消息进行消费。A7. Consume the message through the second consumer of the corresponding second topic type.2.根据权利要求1所述的调节消息优先级的方法,其特征在于,步骤A2包括:2. The method for adjusting message priority according to claim 1, wherein step A2 comprises:确定所述消息的类型;determine the type of the message;根据所述消息的类型获取对应的预设优先级。The corresponding preset priority is obtained according to the type of the message.3.根据权利要求1所述的调节消息优先级的方法,其特征在于,所述工作信息包括位置信息和状态信息;3. The method for adjusting message priority according to claim 1, wherein the work information comprises location information and status information;步骤A3包括:Step A3 includes:根据所述位置信息获取第一状态系数;obtaining a first state coefficient according to the location information;根据所述状态信息获取第二状态系数;obtaining a second state coefficient according to the state information;根据所述第一状态系数和所述第二状态系数计算所述工作状态系数。The operating state coefficient is calculated based on the first state coefficient and the second state coefficient.4.根据权利要求1所述的调节消息优先级的方法,其特征在于,步骤A5包括:4. The method for adjusting message priority according to claim 1, wherein step A5 comprises:由所述第一个消息队列的第一消费者,计算所述消息的预设优先级和所述工作状态系数的乘积,得到所述优先值。The priority value is obtained by calculating the product of the preset priority of the message and the working state coefficient by the first consumer of the first message queue.5.根据权利要求1所述的调节消息优先级的方法,其特征在于,步骤A4包括:5. The method for adjusting message priority according to claim 1, wherein step A4 comprises:根据所述预设优先级把所述消息放入所述第一个消息队列的对应的第一主题类型中;Putting the message into the corresponding first topic type of the first message queue according to the preset priority;步骤A5包括:Step A5 includes:通过所述对应的第一主题类型的第一消费者,根据所述消息的预设优先级和所述工作状态系数计算所述消息的优先值;Calculate the priority value of the message according to the preset priority of the message and the working state coefficient through the corresponding first consumer of the first topic type;步骤A6包括:Step A6 includes:通过所述对应的第一主题类型的第一消费者,根据所述优先值把所述消息放入所述第二个消息队列的所述对应的第二主题类型中。By the first consumer of the corresponding first topic type, the message is put into the corresponding second topic type of the second message queue according to the priority value.6.根据权利要求1所述的调节消息优先级的方法,其特征在于,所述第二个消息队列包括多个不同的第二主题类型,各所述第二主题类型对应不同的优先值范围;6 . The method for adjusting message priority according to claim 1 , wherein the second message queue comprises a plurality of different second topic types, and each of the second topic types corresponds to a different priority value range. 7 . ;步骤A6包括:Step A6 includes:通过所述第一个消息队列的第一消费者,根据所述优先值所处的范围,把所述消息放入所述第二个消息队列的所述对应的第二主题类型中。The first consumer of the first message queue puts the message into the corresponding second topic type of the second message queue according to the range of the priority value.7.根据权利要求1所述的调节消息优先级的方法,其特征在于,步骤A7包括:7. The method for adjusting message priority according to claim 1, wherein step A7 comprises:通过所述对应的第二主题类型的多个所述第二消费者之一对所述消息进行消费。The message is consumed by one of the plurality of second consumers of the corresponding second topic type.8.一种调节消息优先级的装置,其特征在于,包括:8. A device for adjusting message priority, comprising:第一获取模块,用于获取消息主体发送的消息和工作信息;The first obtaining module is used to obtain the message and work information sent by the message body;第二获取模块,用于获取所述消息的预设优先级;a second obtaining module, configured to obtain the preset priority of the message;第三获取模块,用于根据所述工作信息获取工作状态系数;a third obtaining module, configured to obtain the working state coefficient according to the working information;第一处理模块,用于把所述消息放入第一个消息队列;a first processing module, configured to put the message into the first message queue;计算模块,用于通过所述第一个消息队列的第一消费者,根据所述消息的预设优先级和所述工作状态系数计算所述消息的优先值;A calculation module, configured to calculate the priority value of the message according to the preset priority of the message and the working state coefficient through the first consumer of the first message queue;第二处理模块,用于通过所述第一个消息队列的第一消费者,根据所述优先值把所述消息放入第二个消息队列的对应的第二主题类型中;The second processing module is configured to put the message into the corresponding second topic type of the second message queue according to the priority value through the first consumer of the first message queue;执行模块,用于通过所述对应的第二主题类型的第二消费者对所述消息进行消费。An execution module, configured to consume the message through the second consumer of the corresponding second topic type.9.一种电子设备,其特征在于,包括处理器和存储器,所述存储器存储有所述处理器可执行的计算机程序,所述处理器执行所述计算机程序时,运行如权利要求1-7任一项所述调节消息优先级的方法中的步骤。9. An electronic device, characterized in that it comprises a processor and a memory, wherein the memory stores a computer program executable by the processor, and when the processor executes the computer program, the processor executes the steps of claims 1-7. The steps in any one of the methods for adjusting message priority.10.一种计算机存储介质,其上存储有计算机程序,其特征在于,所述计算机程序被处理器执行时运行如权利要求1-7任一项所述调节消息优先级的方法中的步骤。10. A computer storage medium on which a computer program is stored, wherein when the computer program is executed by a processor, the steps in the method for adjusting the priority of a message according to any one of claims 1-7 are executed.
CN202210332814.XA2022-03-312022-03-31Method and device for adjusting message priority, electronic equipment and storage mediumPendingCN114428693A (en)

Priority Applications (1)

Application NumberPriority DateFiling DateTitle
CN202210332814.XACN114428693A (en)2022-03-312022-03-31Method and device for adjusting message priority, electronic equipment and storage medium

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
CN202210332814.XACN114428693A (en)2022-03-312022-03-31Method and device for adjusting message priority, electronic equipment and storage medium

Publications (1)

Publication NumberPublication Date
CN114428693Atrue CN114428693A (en)2022-05-03

Family

ID=81314249

Family Applications (1)

Application NumberTitlePriority DateFiling Date
CN202210332814.XAPendingCN114428693A (en)2022-03-312022-03-31Method and device for adjusting message priority, electronic equipment and storage medium

Country Status (1)

CountryLink
CN (1)CN114428693A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN114885018A (en)*2022-06-222022-08-09中国平安财产保险股份有限公司Message pushing method, device, equipment and storage medium based on double queues
CN115348231A (en)*2022-08-172022-11-15北京蔚领时代科技有限公司Message processing method, device, server and storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
US20090168793A1 (en)*2006-03-302009-07-02David FoxPrioritising Data Transmission
CN107483360A (en)*2016-06-082017-12-15中兴通讯股份有限公司Service flow scheduling method and device
CN112000446A (en)*2020-07-132020-11-27深圳市优必选科技股份有限公司Data transmission method and robot

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
US20090168793A1 (en)*2006-03-302009-07-02David FoxPrioritising Data Transmission
CN107483360A (en)*2016-06-082017-12-15中兴通讯股份有限公司Service flow scheduling method and device
CN112000446A (en)*2020-07-132020-11-27深圳市优必选科技股份有限公司Data transmission method and robot

Cited By (4)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN114885018A (en)*2022-06-222022-08-09中国平安财产保险股份有限公司Message pushing method, device, equipment and storage medium based on double queues
CN114885018B (en)*2022-06-222023-08-29中国平安财产保险股份有限公司Message pushing method, device, equipment and storage medium based on double queues
CN115348231A (en)*2022-08-172022-11-15北京蔚领时代科技有限公司Message processing method, device, server and storage medium
CN115348231B (en)*2022-08-172023-12-12北京蔚领时代科技有限公司Message processing method, device, server side and storage medium

Similar Documents

PublicationPublication DateTitle
CN114428693A (en)Method and device for adjusting message priority, electronic equipment and storage medium
CN109257270B (en)Work order mail processing method, system, server and storage medium
CN111274052A (en)Data distribution method, server, and computer-readable storage medium
EA012934B1 (en)A system and a method for managing remote applications
US8205198B2 (en)System and method for monitoring a workflow process and generating reminder alerts using modular arithmetic
CN108491301A (en)Electronic device, the abnormity early warning method based on redis and storage medium
EP3575966B1 (en)Method and system for handling engineering data in a multi- engineering system environment
CN110708197B (en)Monitoring device, method for setting monitoring policy of monitoring device, and storage medium
CN112001664B (en)Method, device, equipment and storage medium for generating return tasks
CN113259446A (en)APP message sending method, device, equipment and medium based on user loyalty
CN113222506A (en)Logistics data processing method and system for third-party contract logistics information platform
JP5935511B2 (en) Program and campaign management device
CN114367983B (en)Abnormality processing method, robot, conveyance system, program product, and storage medium
EP1721428A1 (en)Methods, apparatus and computer program products for dispatching and prioritizing communication of generic-recipient messages to recipients
CN111026746A (en)Method and device for multi-channel data calling, computer equipment and storage medium
CN113706082A (en)Supply chain management method, system and computer readable storage medium
US20190236541A1 (en)Automated exception event handler for resolving shipping exceptions
TWM601865U (en)Material inventory early-warning system
CN108614460B (en)Distributed multi-node control system and method
US20090164523A1 (en)System and method for sending messages
CN107678839B (en) Priority-based customer follow-up method, system and readable storage medium
CN108427615B (en)Message monitoring method and device
CN112672369B (en)Electronic price tag management method, server and computer readable storage medium
EP1383062A2 (en)Manufacturing data access
CN115760317A (en)Business order processing method and device, computer equipment and storage medium

Legal Events

DateCodeTitleDescription
PB01Publication
PB01Publication
SE01Entry into force of request for substantive examination
SE01Entry into force of request for substantive examination
RJ01Rejection of invention patent application after publication
RJ01Rejection of invention patent application after publication

Application publication date:20220503


[8]ページ先頭

©2009-2025 Movatter.jp