CN114844844A - Delay message processing method, device, equipment and storage medium - Google Patents

Delay message processing method, device, equipment and storage medium Download PDF

Info

Publication number
CN114844844A
CN114844844A CN202210439867.1A CN202210439867A CN114844844A CN 114844844 A CN114844844 A CN 114844844A CN 202210439867 A CN202210439867 A CN 202210439867A CN 114844844 A CN114844844 A CN 114844844A
Authority
CN
China
Prior art keywords
delay
message
time
delay time
preset
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
CN202210439867.1A
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.)
Ping An Puhui Enterprise Management Co Ltd
Original Assignee
Ping An Puhui Enterprise Management Co 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 Ping An Puhui Enterprise Management Co Ltd filed Critical Ping An Puhui Enterprise Management Co Ltd
Priority to CN202210439867.1A priority Critical patent/CN114844844A/en
Publication of CN114844844A publication Critical patent/CN114844844A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/50Queue scheduling
    • H04L47/56Queue scheduling implementing delay-aware scheduling
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L51/00User-to-user messaging in packet-switching networks, transmitted according to store-and-forward or real-time protocols, e.g. e-mail
    • H04L51/07User-to-user messaging in packet-switching networks, transmitted according to store-and-forward or real-time protocols, e.g. e-mail characterised by the inclusion of specific contents
    • H04L51/18Commands or executable codes

Abstract

The invention relates to a message processing technology, and discloses a delay message processing method, which comprises the following steps: receiving a delay message set by using a pre-constructed delay message queue; querying the delay time of each delay message; sequencing each delay message according to the delay time to obtain a delay sequence, and loading each delay message into a preset storage server according to the delay sequence; inquiring the delay time of the delay message at the first of the delay sequence in the storage server to obtain the first delay time, and judging whether the first delay time reaches a preset delay time threshold value; when the delay time threshold is not reached, the first delay message of the delay sequence is waited to reach the delay time threshold and then processed; and when the delay time threshold is reached, the delay message at the first position of the delay sequence is transmitted to the corresponding message consumption end for consumption. The invention also provides a delay message processing device, equipment and a storage medium. The invention can improve the processing efficiency of the delay message.

Description

Delayed message processing method, device, equipment and storage medium
Technical Field
The present invention relates to the field of message processing technologies, and in particular, to a method, an apparatus, a device, and a storage medium for processing a delayed message.
Background
The delay message refers to a message task that needs to be delayed and processed in the process of pushing the large-scale service message by the service message in the service system.
In the traditional processing of the delay message, usually, a message producer issues the delay message to a message middleware, and the message middleware issues the delay message to a message consumption end for consumption, but unprocessed large batches of delay messages are sent to the message consumption end at the same time for receiving, so that the problem of slow processing of the service message is generated, and the processing efficiency of the service message is influenced. Therefore, a method for implementing ordered processing of delayed messages is needed to solve the problem of low efficiency of processing delayed messages.
Disclosure of Invention
The invention provides a method, a device, equipment and a storage medium for processing a delay message, and mainly aims to solve the problem of low processing efficiency of the delay message.
In order to achieve the above object, a method for processing a delay message provided by the present invention includes:
acquiring a delay message set, and receiving the delay message set by using a pre-constructed delay message queue to obtain a delay queue message set;
querying the delay time of each delay message in the delay queue message set;
sequencing each delay message according to the delay time to obtain a delay sequence, and loading each delay message into a preset storage server according to the delay sequence;
inquiring the delay time of the delay message of the first delay order in the storage server to obtain the first delay time, and judging whether the first delay time reaches a preset delay time threshold value;
when the first delay time does not reach a preset delay time threshold, processing is carried out when the delay message of the first delay sequence reaches the preset delay time threshold;
and when the first delay time reaches a preset delay time threshold, issuing the delay message of the first delay sequence in the delay server to a corresponding message consumption end for consumption.
Optionally, the obtaining the delayed message set includes:
acquiring a storage path of the delay message, and compiling the storage path into path parameters;
and assigning a preset data interface by using the path parameter, calling the delay message by using the assigned data interface, and summarizing the delay message obtained by calling to obtain a delay message set.
Optionally, the querying a delay time of each delay message in the delay queue message set includes:
extracting the message attribute of each delay message;
splitting the message attribute to obtain the time to be consumed of each delay message;
and acquiring current natural time from a preset time system, and respectively calculating the time difference between the time to be consumed of each delay message and the current natural time to obtain the delay time.
Optionally, the sorting each of the delay messages according to the delay time includes:
sequentially numbering the delay time of each delay message to obtain a time number set;
selecting a time number corresponding to the minimum delay time as an initial time number, and taking the delay time corresponding to the polling initial number as initial delay time;
polling the time number set by taking the polling initial number as a starting point according to a preset polling rule;
when the time number obtained by polling accords with a preset polling rule, extracting the delay time corresponding to the time number, and removing the time number from the time number set;
calculating the distance between the delay time corresponding to the time number and the initial delay time, and sequencing the delay time corresponding to the time number after the initial delay time in a progressive manner according to the distance;
and repeatedly polling the time number set until the time number set has the preset number.
Optionally, the step of sequencing the delay time corresponding to the time number after the initial delay time in a progressive manner according to the distance includes:
determining the distance value of the delay time corresponding to each time number relative to the initial delay time;
and traversing the distance values of two adjacent time numbers, and sequencing progressively from small to large until finishing sequencing of the delay time corresponding to each time number in the time number set.
Optionally, the calculating a distance between the delay time corresponding to the time number and the initial delay time includes:
the distance between the delay time corresponding to the time number and the initial delay time can be calculated by adopting the following distance formula:
Figure BDA0003614662050000031
wherein x is i The delay time corresponding to the ith time number,
Figure BDA0003614662050000032
for the initial delay time, p is a distance parameter, typically the value of p is 2.
Optionally, the sending the delay message at the first of the delay sequences in the delay server to a corresponding message consumption end for consumption includes:
identifying a message consumption category of the delayed message at the first of the delay sequence;
and receiving the delay message of the first position of the delay sequence by utilizing a real-time message queue corresponding to the message consumption category according to the message consumption category, and sending the delay message of the first position of the delay sequence to a corresponding message consumption end for consumption by utilizing the real-time message queue.
In order to solve the above problem, the present invention further provides a delayed message processing apparatus, including:
the delay message acquisition module is used for acquiring a delay message set, receiving the delay message set by using a pre-constructed delay message queue and obtaining a delay queue message set;
the delay message sequencing module is used for inquiring the delay time of each delay message in the delay queue message set; sequencing each delay message according to the delay time to obtain a delay sequence, and loading each delay message into a preset storage server according to the delay sequence;
the delay message processing module is used for inquiring the delay time of the delay message at the first position of the delay sequence in the storage server to obtain the first delay time and judging whether the first delay time reaches a preset delay time threshold value; when the first delay time does not reach a preset delay time threshold, waiting for the delay message of the first delay sequence to reach the preset delay time threshold and then processing; and when the first delay time reaches a preset delay time threshold, issuing the delay message of the first delay sequence in the delay server to a corresponding message consumption end for consumption.
In order to solve the above problem, the present invention also provides an electronic device, including:
at least one processor; and the number of the first and second groups,
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores a computer program executable by the at least one processor, the computer program being executable by the at least one processor to enable the at least one processor to perform the delayed message processing method described above.
In order to solve the above problem, the present invention also provides a computer-readable storage medium, in which at least one computer program is stored, and the at least one computer program is executed by a processor in an electronic device to implement the delayed message processing method described above.
The embodiment of the invention receives the delay message set through the pre-constructed delay message queue to obtain the delay queue message set, can consume the delay messages in the independent delay message queue, does not occupy the message queue of the normal messages, and improves the message processing efficiency.
Drawings
Fig. 1 is a schematic flowchart of a method for processing a delay message according to an embodiment of the present invention;
fig. 2 is a detailed flowchart illustrating a step in a delayed message processing method according to an embodiment of the present invention;
fig. 3 is a detailed flowchart illustrating a step in a delayed message processing method according to an embodiment of the present invention;
fig. 4 is a functional block diagram of a delayed message processing apparatus according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of an electronic device implementing the delay message processing method according to an embodiment of the present invention.
The implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
The embodiment of the application provides a delayed message processing method. The execution subject of the delayed message processing method includes, but is not limited to, at least one of electronic devices that can be configured to execute the method provided by the embodiments of the present application, such as a server, a terminal, and the like. In other words, the delayed message processing method may be performed by software or hardware installed in the terminal device or the server device, and the software may be a block chain platform. The server includes but is not limited to: a single server, a server cluster, a cloud server or a cloud server cluster, and the like. The server may be an independent server, or may be a cloud server that provides basic cloud computing services such as a cloud service, a cloud database, cloud computing, a cloud function, cloud storage, a web service, cloud communication, a middleware service, a domain name service, a security service, a Content Delivery Network (CDN), and a big data and artificial intelligence platform.
Fig. 1 is a schematic flow chart of a method for processing a delay message according to an embodiment of the present invention. In this embodiment, the method for processing the delay message includes the following steps S1-S6:
s1, obtaining a delay message set, and receiving the delay message set by using a pre-constructed delay message queue to obtain a delay queue message set.
In the embodiment of the present invention, the delay message set refers to a set of delay message tasks that need to be delayed. For example, in the order generation service, the delayed message task may be a message task for canceling an order if the order is not paid for more than a preset time, or the delayed message task may be a message task for automatically defaulting to good comment if the order is not evaluated for more than the preset time in the order evaluation service.
In detail, the obtaining the delayed message set includes: acquiring a storage path of the delay message, and compiling the storage path into path parameters; and assigning a preset data interface by using the path parameter, calling the delay message by using the assigned data interface, and summarizing the delay message obtained by calling to obtain a delay message set.
In the embodiment of the invention, the storage path can be uploaded in advance by personnel who have the processing authority on the health data, such as a service person and an administrator.
In the embodiment of the present invention, a preset compiler may be used to compile the storage path into a path parameter, and assign a preset data interface using the path parameter, and the data interface may be used to call data in the storage path, where the compiler includes, but is not limited to: microsoft Visual Studio, Dev-C + +, C + + Builder, Emacs + GC.
In the embodiment of the present invention, the pre-constructed delay message queue refers to a delay Topic created based on a Kafka stream processing platform, and is used for receiving a message task requiring delay processing.
And S2, inquiring the delay time of each delay message in the delay queue message set.
The embodiment of the invention can sort the delay message sets according to the size of the delay time by inquiring the delay time of each delay message in the delay queue message set, and determine the consumption priority of the delay messages.
In detail, referring to fig. 2, as an embodiment of the present invention, the querying the delay time of each delay message in the delay queue message set includes the following steps S20-S22:
s20, extracting the message attribute of each delay message;
s21, splitting the message attribute to obtain the time to be consumed of each delay message;
and S22, acquiring the current natural time from a preset time system, and respectively calculating the time difference between the time to be consumed of each delay message and the current natural time to obtain the delay time.
In the embodiment of the invention, the message attribute refers to the message type, the message detail information, the message initial time, the message to-be-consumed time and the like contained in the delay message.
In the embodiment of the invention, the preset time system is a time management system based on standard time, and when a time query instruction of a user is received, the current time is issued to the user.
S3, sequencing each delay message according to the delay time to obtain a delay sequence, and loading each delay message into a preset storage server according to the delay sequence.
According to the embodiment of the invention, each delay message is sequenced according to the delay time, so that the orderliness of the delay messages during consumption can be realized.
In detail, referring to fig. 3, as an embodiment of the present invention, the sorting each delay message according to the delay time includes the following steps S30-S35:
s30, numbering the delay time of each delay message in sequence to obtain a time number set;
s31, selecting a time number corresponding to the minimum delay time as an initial time number, and taking the delay time corresponding to the polling initial number as the initial delay time;
s32, polling the time number set by taking the polling initial number as a starting point according to a preset polling rule;
s33, when the time number obtained by polling accords with a preset polling rule, extracting the delay time corresponding to the time number, and removing the time number from the time number set;
s34, calculating the distance between the delay time corresponding to the time number and the initial delay time, and sequencing the delay time corresponding to the time number after the initial delay time in a progressive manner according to the distance;
and S35, repeatedly polling the time number set until the time number set has the preset number.
In the embodiment of the present invention, the polling rule refers to a rule defined when a polling operation is performed. For example, a natural number set is [0,1,2,3,4,5,6,7,8,9,10], and when the defined number 4 is a polling initial point and the polling rule is to perform a number rearrangement process every 6 numbers, the final polling rearrangement result is [4, 10, 6, 2, 0, 9,1, 5, 8, 7, 3 ].
The embodiment of the invention can adopt the following distance formula to calculate the distance between the delay time corresponding to the time number and the initial delay time:
Figure BDA0003614662050000071
wherein x is i The delay time corresponding to the ith time number,
Figure BDA0003614662050000072
for the initial delay time, p is a distance parameter, typically the value of p is 2.
In the embodiment of the invention, the preset storage server is a high-performance embedded KV storage server based on RocksDB.
S4, inquiring the delay time of the delay sequence first delay message in the storage server to obtain the first delay time, and judging whether the first delay time reaches a preset delay time threshold value.
In the embodiment of the present invention, the preset delay time threshold refers to a delay time reference point for issuing a delay message to a message consumption end for consumption, where the preset delay time threshold may be set to 5 seconds. For example, the delay time of a certain delay message is 30 seconds, and when the delay time countdown of the certain delay message reaches 5 seconds, the certain delay message is issued to the message consumption end for consumption.
And when the first delay time does not reach a preset delay time threshold, executing S5, and processing when the delay message of the first delay sequence reaches the preset delay time threshold.
And when the first delay time reaches a preset delay time threshold, executing S6, and sending the delay message of the first delay sequence in the delay server to a corresponding message consumption end for consumption.
The embodiment of the invention transmits the delay message at the first position of the delay sequence in the delay server to the corresponding message consumption end for consumption, can realize accurate consumption of the delay message and improve the efficiency of message consumption.
As an embodiment of the present invention, the issuing the delay message at the first of the delay sequence in the delay server to the corresponding message consuming end for consuming includes: identifying a message consumption category of the delayed message at the first of the delay sequence; and receiving the delay message of the first position of the delay sequence by utilizing a real-time message queue corresponding to the message consumption category according to the message consumption category, and sending the delay message of the first position of the delay sequence to a corresponding message consumption end for consumption by utilizing the real-time message queue.
The embodiment of the invention receives the delay message set through the pre-constructed delay message queue to obtain the delay queue message set, can consume the delay messages in the independent delay message queue, does not occupy the message queue of the normal messages, and improves the message processing efficiency.
Fig. 4 is a functional block diagram of a delayed message processing apparatus according to an embodiment of the present invention.
The delay message processing apparatus 100 of the present invention may be installed in an electronic device. According to the implemented functions, the delay message processing apparatus 100 may include a delay message obtaining module 101, a delay message sorting module 102, and a delay message processing module 103. The module of the present invention, which may also be referred to as a unit, refers to a series of computer program segments that can be executed by a processor of an electronic device and that can perform a fixed function, and that are stored in a memory of the electronic device.
In the present embodiment, the functions regarding the respective modules/units are as follows:
the delay message acquiring module 101 is configured to acquire a delay message set, and receive the delay message set by using a pre-constructed delay message queue to obtain a delay queue message set;
in the embodiment of the present invention, the delay message set refers to a set of delay message tasks that need to be delayed. For example, in the order generation service, the delayed message task may be a message task for canceling an order if the order is not paid for more than a preset time, or the delayed message task may be a message task for automatically defaulting to good comment if the order is not evaluated for more than the preset time in the order evaluation service.
In detail, the obtaining the delayed message set includes: acquiring a storage path of the delay message, and compiling the storage path into path parameters; and assigning a preset data interface by using the path parameter, calling the delay message by using the assigned data interface, and summarizing the delay message obtained by calling to obtain a delay message set.
In the embodiment of the invention, the storage path can be uploaded in advance by personnel who have the processing authority on the health data, such as a service person and an administrator.
In the embodiment of the present invention, a preset compiler may be used to compile the storage path into a path parameter, and assign a value to a preset data interface using the path parameter, and the data interface may be used to call data in the storage path, where the compiler includes but is not limited to: microsoft Visual Studio, Dev-C + +, C + + Builder, Emacs + GC.
In the embodiment of the present invention, the pre-constructed delay message queue refers to a delay Topic created based on a Kafka stream processing platform, and is used for receiving a message task requiring delay processing.
The delay message sorting module 102 is configured to query a delay time of each delay message in the delay queue message set; sequencing each delay message according to the delay time to obtain a delay sequence, and loading each delay message into a preset storage server according to the delay sequence;
the embodiment of the invention can sort the delay message sets according to the size of the delay time by inquiring the delay time of each delay message in the delay queue message set, and determine the consumption priority of the delay messages.
As an embodiment of the present invention, the querying a delay time of each delay message in the delay queue message set includes: extracting the message attribute of each delay message; splitting the message attribute to obtain the time to be consumed of each delay message; and acquiring current natural time from a preset time system, and respectively calculating the time difference between the time to be consumed of each delay message and the current natural time to obtain the delay time.
In the embodiment of the invention, the message attribute refers to the message type, the message detail information, the message initial time, the message to-be-consumed time and the like contained in the delay message.
In the embodiment of the invention, the preset time system is a time management system based on standard time, and when a time query instruction of a user is received, the current time is issued to the user.
According to the embodiment of the invention, each delay message is sequenced according to the delay time, so that the orderliness of the delay messages during consumption can be realized.
As an embodiment of the present invention, the sorting each of the delay messages according to the delay time includes: sequentially numbering the delay time of each delay message to obtain a time number set; selecting a time number corresponding to the minimum delay time as an initial time number, and taking the delay time corresponding to the polling initial number as initial delay time; polling the time number set by taking the polling initial number as a starting point according to a preset polling rule; when the time number obtained by polling accords with a preset polling rule, extracting the delay time corresponding to the time number, and removing the time number from the time number set; calculating the distance between the delay time corresponding to the time number and the initial delay time, and sequencing the delay time corresponding to the time number after the initial delay time in a progressive manner according to the distance; and repeatedly polling the time number set until the time number set has the preset number.
In the embodiment of the present invention, the polling rule refers to a rule defined when a polling operation is performed. For example, a natural number set is [0,1,2,3,4,5,6,7,8,9,10], and when the defined number 4 is a polling initial point and the polling rule is to perform a number rearrangement process every 6 numbers, the final polling rearrangement result is [4, 10, 6, 2, 0, 9,1, 5, 8, 7, 3 ].
The embodiment of the invention can adopt the following distance formula to calculate the distance between the delay time corresponding to the time number and the initial delay time:
Figure BDA0003614662050000101
wherein x is i The delay time corresponding to the ith time number,
Figure BDA0003614662050000102
for the initial delay time, p is a distance parameter, typically the value of p is 2.
In the embodiment of the invention, the preset storage server is a high-performance embedded KV storage server based on RocksDB.
The delay message processing module 103 is configured to query a delay time of a first delay message of a delay sequence in the storage server, obtain a first delay time, and determine whether the first delay time reaches a preset delay time threshold; when the first delay time does not reach a preset delay time threshold, waiting for the delay message of the first delay sequence to reach the preset delay time threshold and then processing; and when the first delay time reaches a preset delay time threshold, issuing the delay message of the first delay sequence in the delay server to a corresponding message consumption end for consumption.
In the embodiment of the present invention, the preset delay time threshold refers to a delay time reference point for issuing a delay message to a message consumption end for consumption, where the preset delay time threshold may be set to 5 seconds. For example, the delay time of a certain delay message is 30 seconds, and when the delay time countdown of the certain delay message reaches 5 seconds, the certain delay message is issued to the message consumption end for consumption.
And when the first delay time does not reach a preset delay time threshold, waiting for the delay message of the first delay sequence to reach the preset delay time threshold, and then processing.
And when the first delay time reaches a preset delay time threshold, issuing the delay message of the first delay sequence in the delay server to a corresponding message consumption end for consumption.
The embodiment of the invention transmits the delay message at the first position of the delay sequence in the delay server to the corresponding message consumption end for consumption, can realize accurate consumption of the delay message and improve the efficiency of message consumption.
As an embodiment of the present invention, the issuing the delay message at the first of the delay sequence in the delay server to the corresponding message consuming end for consuming includes: identifying a message consumption category of the delayed message at the first of the delay sequence; and receiving the delay message of the first position of the delay sequence by utilizing a real-time message queue corresponding to the message consumption category according to the message consumption category, and sending the delay message of the first position of the delay sequence to a corresponding message consumption end for consumption by utilizing the real-time message queue.
Fig. 5 is a schematic structural diagram of an electronic device implementing the method for processing a delayed message according to an embodiment of the present invention.
The electronic device 1 may comprise a processor 10, a memory 11, a communication bus 12 and a communication interface 13, and may further comprise a computer program, such as a time-lapse message processing program, stored in the memory 11 and executable on the processor 10.
In some embodiments, the processor 10 may be composed of an integrated circuit, for example, a single packaged integrated circuit, or may be composed of a plurality of integrated circuits packaged with the same function or different functions, and includes one or more Central Processing Units (CPUs), a microprocessor, a digital Processing chip, a graphics processor, a combination of various control chips, and the like. The processor 10 is a Control Unit (Control Unit) of the electronic device, connects various components of the electronic device by using various interfaces and lines, and executes various functions and processes data of the electronic device by running or executing programs or modules (e.g., executing a delay message processing program, etc.) stored in the memory 11 and calling data stored in the memory 11.
The memory 11 includes at least one type of readable storage medium including flash memory, removable hard disks, multimedia cards, card-type memory (e.g., SD or DX memory, etc.), magnetic memory, magnetic disks, optical disks, etc. The memory 11 may in some embodiments be an internal storage unit of the electronic device, for example a removable hard disk of the electronic device. The memory 11 may also be an external storage device of the electronic device in other embodiments, such as a plug-in mobile hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like, which are provided on the electronic device. Further, the memory 11 may also include both an internal storage unit and an external storage device of the electronic device. The memory 11 may be used not only to store application software installed in the electronic device and various types of data, such as codes of a delayed message processing program, etc., but also to temporarily store data that has been output or is to be output.
The communication bus 12 may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The bus may be divided into an address bus, a data bus, a control bus, etc. The bus is arranged to enable connection communication between the memory 11 and at least one processor 10 or the like.
The communication interface 13 is used for communication between the electronic device and other devices, and includes a network interface and a user interface. Optionally, the network interface may include a wired interface and/or a wireless interface (e.g., WI-FI interface, bluetooth interface, etc.), which are typically used to establish a communication connection between the electronic device and other electronic devices. The user interface may be a Display (Display), an input unit such as a Keyboard (Keyboard), and optionally a standard wired interface, a wireless interface. Alternatively, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode) touch device, or the like. The display, which may also be referred to as a display screen or display unit, is suitable, among other things, for displaying information processed in the electronic device and for displaying a visualized user interface.
Fig. 5 only shows an electronic device with components, and it will be understood by a person skilled in the art that the structure shown in fig. 5 does not constitute a limitation of the electronic device 1, and may comprise fewer or more components than shown, or a combination of certain components, or a different arrangement of components.
For example, although not shown, the electronic device may further include a power supply (such as a battery) for supplying power to each component, and preferably, the power supply may be logically connected to the at least one processor 10 through a power management device, so that functions of charge management, discharge management, power consumption management and the like are realized through the power management device. The power supply may also include any component of one or more dc or ac power sources, recharging devices, power failure detection circuitry, power converters or inverters, power status indicators, and the like. The electronic device may further include various sensors, a bluetooth module, a Wi-Fi module, and the like, which are not described herein again.
It is to be understood that the described embodiments are for purposes of illustration only and that the scope of the appended claims is not limited to such structures.
The memory 11 of the electronic device 1 stores a delayed message processing program that is a combination of instructions that, when executed in the processor 10, enable:
acquiring a delay message set, and receiving the delay message set by using a pre-constructed delay message queue to obtain a delay queue message set;
querying the delay time of each delay message in the delay queue message set;
sequencing each delay message according to the delay time to obtain a delay sequence, and loading each delay message into a preset storage server according to the delay sequence;
inquiring the delay time of the delay message of the first delay order in the storage server to obtain the first delay time, and judging whether the first delay time reaches a preset delay time threshold value;
when the first delay time does not reach a preset delay time threshold, waiting for the delay message of the first delay sequence to reach the preset delay time threshold and then processing;
and when the first delay time reaches a preset delay time threshold, issuing the delay message of the first delay sequence in the delay server to a corresponding message consumption end for consumption.
Specifically, the specific implementation method of the instruction by the processor 10 may refer to the description of the relevant steps in the embodiment corresponding to the drawings, which is not described herein again.
Further, the integrated modules/units of the electronic device 1, 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. The computer readable storage medium may be volatile or non-volatile. For example, the computer-readable medium may include: any entity or device capable of carrying said computer program code, recording medium, U-disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM).
The present invention also provides a computer-readable storage medium, storing a computer program which, when executed by a processor of an electronic device, may implement:
acquiring a delay message set, and receiving the delay message set by using a pre-constructed delay message queue to obtain a delay queue message set;
querying the delay time of each delay message in the delay queue message set;
sequencing each delay message according to the delay time to obtain a delay sequence, and loading each delay message into a preset storage server according to the delay sequence;
inquiring the delay time of the delay message of the first delay order in the storage server to obtain the first delay time, and judging whether the first delay time reaches a preset delay time threshold value;
when the first delay time does not reach a preset delay time threshold, waiting for the delay message of the first delay sequence to reach the preset delay time threshold and then processing;
and when the first delay time reaches a preset delay time threshold, issuing the delay message of the first delay sequence in the delay server to a corresponding message consumption end for consumption.
In the embodiments provided in the present invention, it should be understood that the disclosed apparatus, device and method can be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the modules is only one logical functional division, and other divisions may be realized in practice.
The modules described as separate parts may or may not be physically separate, and parts displayed as modules 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 modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment.
In addition, functional modules 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, or in a form of hardware plus a software functional module.
It will be evident to those skilled in the art that the invention is not limited to the details of the foregoing illustrative embodiments, and that the present invention may be embodied in other specific forms without departing from the spirit or essential attributes thereof.
The present embodiments are therefore to be considered in all respects as illustrative and not restrictive, the scope of the invention being indicated by the appended claims rather than by the foregoing description, and all changes which come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein. Any reference signs in the claims shall not be construed as limiting the claim concerned.
The block chain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism, an encryption algorithm and the like. A block chain (Blockchain), which is essentially a decentralized database, is a series of data blocks associated by using a cryptographic method, and each data block contains information of a batch of network transactions, so as to verify the validity (anti-counterfeiting) of the information and generate a next block. The blockchain may include a blockchain underlying platform, a platform product service layer, an application service layer, and the like.
The embodiment of the application can acquire and process related data based on an artificial intelligence technology. Among them, Artificial Intelligence (AI) is a theory, method, technique and application system that simulates, extends and expands human Intelligence using a digital computer or a machine controlled by a digital computer, senses the environment, acquires knowledge and uses the knowledge to obtain the best result.
Furthermore, it is obvious that the word "comprising" does not exclude other elements or steps, and the singular does not exclude the plural. A plurality of units or means recited in the system claims may also be implemented by one unit or means in software or hardware. The terms first, second, etc. are used to denote names, but not any particular order.
Finally, it should be noted that the above embodiments are only for illustrating the technical solutions of the present invention and not for limiting, and although the present invention is described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that modifications or equivalent substitutions may be made on the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention.

Claims (10)

1. A method for processing a delayed message, the method comprising:
acquiring a delay message set, and receiving the delay message set by using a pre-constructed delay message queue to obtain a delay queue message set;
querying the delay time of each delay message in the delay queue message set;
sequencing each delay message according to the delay time to obtain a delay sequence, and loading each delay message into a preset storage server according to the delay sequence;
inquiring the delay time of the delay message of the first delay order in the storage server to obtain the first delay time, and judging whether the first delay time reaches a preset delay time threshold value;
when the first delay time does not reach a preset delay time threshold, waiting for the delay message of the first delay sequence to reach the preset delay time threshold and then processing;
and when the first delay time reaches a preset delay time threshold, issuing the delay message of the first delay sequence in the delay server to a corresponding message consumption end for consumption.
2. The method for processing delayed messages according to claim 1, wherein said obtaining a delayed message set comprises:
acquiring a storage path of the delay message, and compiling the storage path into path parameters;
and assigning a preset data interface by using the path parameter, calling the delay message by using the assigned data interface, and summarizing the delay message obtained by calling to obtain a delay message set.
3. The method for processing delayed messages according to claim 1, wherein said querying the delay time of each delayed message in said delayed queue message set comprises:
extracting the message attribute of each delay message;
splitting the message attribute to obtain the time to be consumed of each delay message;
and acquiring current natural time from a preset time system, and respectively calculating the time difference between the time to be consumed of each delay message and the current natural time to obtain the delay time.
4. The method for processing delayed messages according to claim 1, wherein said sorting each of said delayed messages according to said delay time comprises:
sequentially numbering the delay time of each delay message to obtain a time number set;
selecting a time number corresponding to the minimum delay time as an initial time number, and taking the delay time corresponding to the polling initial number as initial delay time;
polling the time number set by taking the polling initial number as a starting point according to a preset polling rule;
when the time number obtained by polling accords with a preset polling rule, extracting the delay time corresponding to the time number, and removing the time number from the time number set;
calculating the distance between the delay time corresponding to the time number and the initial delay time, and sequencing the delay time corresponding to the time number after the initial delay time in a progressive manner according to the distance;
and repeatedly polling the time number set until the time number set has the preset number.
5. The method for processing the delayed message according to claim 4, wherein said step of sorting the delay times corresponding to the time numbers after the initial delay time according to the distance comprises:
determining the distance value of the delay time corresponding to each time number relative to the initial delay time;
and traversing the distance values of two adjacent time numbers, and sequencing progressively from small to large until finishing sequencing of the delay time corresponding to each time number in the time number set.
6. The delayed message processing method of claim 4, wherein said calculating the distance between the delay time corresponding to said time number and said initial delay time comprises:
the distance between the delay time corresponding to the time number and the initial delay time can be calculated by adopting the following distance formula:
Figure FDA0003614662040000021
wherein x is i The delay time corresponding to the ith time number,
Figure FDA0003614662040000022
for the initial delay time, p is a distance parameter, typically the value of p is 2.
7. The method for processing delay messages according to claim 1, wherein said sending the delay message with the first delay order in the delay server to the corresponding message consumption end for consumption comprises:
identifying a message consumption category of the delayed message at the first of the delay sequence;
and receiving the delay message of the first position of the delay sequence by utilizing a real-time message queue corresponding to the message consumption category according to the message consumption category, and sending the delay message of the first position of the delay sequence to a corresponding message consumption end for consumption by utilizing the real-time message queue.
8. A delayed message processing apparatus, characterized in that the apparatus comprises:
the delay message acquisition module is used for acquiring a delay message set, receiving the delay message set by using a pre-constructed delay message queue and obtaining a delay queue message set;
the delay message sequencing module is used for inquiring the delay time of each delay message in the delay queue message set; sequencing each delay message according to the delay time to obtain a delay sequence, and loading each delay message into a preset storage server according to the delay sequence;
the delay message processing module is used for inquiring the delay time of the delay message at the first position of the delay sequence in the storage server to obtain the first delay time and judging whether the first delay time reaches a preset delay time threshold value; when the first delay time does not reach a preset delay time threshold, waiting for the delay message of the first delay sequence to reach the preset delay time threshold and then processing; and when the first delay time reaches a preset delay time threshold, issuing the delay message of the first delay sequence in the delay server to a corresponding message consumption end for consumption.
9. An electronic device, characterized in that the electronic device comprises:
at least one processor; and the number of the first and second groups,
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores a computer program executable by the at least one processor to enable the at least one processor to perform the method of delayed message processing as claimed in any one of claims 1 to 7.
10. A computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, implements the delayed message processing method according to any one of claims 1 to 7.
CN202210439867.1A 2022-04-25 2022-04-25 Delay message processing method, device, equipment and storage medium Pending CN114844844A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210439867.1A CN114844844A (en) 2022-04-25 2022-04-25 Delay message processing method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210439867.1A CN114844844A (en) 2022-04-25 2022-04-25 Delay message processing method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN114844844A true CN114844844A (en) 2022-08-02

Family

ID=82565792

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210439867.1A Pending CN114844844A (en) 2022-04-25 2022-04-25 Delay message processing method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114844844A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115469991A (en) * 2022-11-14 2022-12-13 苏州浪潮智能科技有限公司 Timer queue setting method, device and equipment and readable storage medium
CN115469816A (en) * 2022-11-02 2022-12-13 摩尔线程智能科技(北京)有限责任公司 Read-write switching method, device and equipment of memory and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108628671A (en) * 2018-04-28 2018-10-09 北京顶象技术有限公司 Method for scheduling task and device
CN110032438A (en) * 2019-04-24 2019-07-19 北京高途云集教育科技有限公司 Delayed tasks execute method, apparatus and electronic equipment
CN110187980A (en) * 2019-04-19 2019-08-30 北京三快在线科技有限公司 Message queue monitoring method, device, electronic equipment and readable storage medium storing program for executing
CN112925661A (en) * 2021-03-09 2021-06-08 广州虎牙科技有限公司 Message processing method and device, computer equipment and storage medium
CN113987073A (en) * 2021-10-27 2022-01-28 游艺星际(北京)科技有限公司 Method and device for updating state information in delayed mode and electronic equipment

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108628671A (en) * 2018-04-28 2018-10-09 北京顶象技术有限公司 Method for scheduling task and device
CN110187980A (en) * 2019-04-19 2019-08-30 北京三快在线科技有限公司 Message queue monitoring method, device, electronic equipment and readable storage medium storing program for executing
CN110032438A (en) * 2019-04-24 2019-07-19 北京高途云集教育科技有限公司 Delayed tasks execute method, apparatus and electronic equipment
CN112925661A (en) * 2021-03-09 2021-06-08 广州虎牙科技有限公司 Message processing method and device, computer equipment and storage medium
CN113987073A (en) * 2021-10-27 2022-01-28 游艺星际(北京)科技有限公司 Method and device for updating state information in delayed mode and electronic equipment

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115469816A (en) * 2022-11-02 2022-12-13 摩尔线程智能科技(北京)有限责任公司 Read-write switching method, device and equipment of memory and storage medium
CN115469816B (en) * 2022-11-02 2024-01-30 摩尔线程智能科技(北京)有限责任公司 Method, device, equipment and storage medium for switching reading and writing of memory
CN115469991A (en) * 2022-11-14 2022-12-13 苏州浪潮智能科技有限公司 Timer queue setting method, device and equipment and readable storage medium

Similar Documents

Publication Publication Date Title
CN114844844A (en) Delay message processing method, device, equipment and storage medium
CN113890712A (en) Data transmission method and device, electronic equipment and readable storage medium
CN111694844A (en) Enterprise operation data analysis method and device based on configuration algorithm and electronic equipment
CN112579098A (en) Software release method and device, electronic equipment and readable storage medium
CN112256783A (en) Data export method and device, electronic equipment and storage medium
CN112464619B (en) Big data processing method, device and equipment and computer readable storage medium
CN113868528A (en) Information recommendation method and device, electronic equipment and readable storage medium
CN112541688A (en) Service data checking method and device, electronic equipment and computer storage medium
CN114625512A (en) Task scheduling method and device, electronic equipment and storage medium
CN114387021A (en) Service state generation method, device, equipment and storage medium
CN114185588A (en) Incremental package generation method, device, equipment and storage medium
CN114547011A (en) Data extraction method and device, electronic equipment and storage medium
CN114817408A (en) Scheduling resource identification method and device, electronic equipment and storage medium
CN114816371A (en) Message processing method, device, equipment and medium
CN114448930A (en) Short address generation method and device, electronic equipment and computer readable storage medium
CN112446781A (en) Wind control data generation method, device, equipment and computer readable storage medium
CN112667244A (en) Data verification method and device, electronic equipment and computer readable storage medium
CN113626533B (en) Ultraviolet power detection method and device and electronic equipment
CN115225489B (en) Dynamic control method for queue service flow threshold, electronic equipment and storage medium
CN112527842B (en) System flow pushing method and device, electronic equipment and computer readable storage medium
CN114238233A (en) Automatic file cleaning method, device, equipment and storage medium
CN113452768A (en) Data reminding method, device, equipment and storage medium based on associated equipment
CN114399293A (en) Information reminding method, device, equipment and storage medium
CN114723280A (en) Task object allocation method and device, electronic equipment and readable storage medium
CN113032168A (en) Data transmission rate dynamic adjustment method and device, electronic equipment and storage medium

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