CN112118297B - Control method, device, equipment and storage medium for delay message - Google Patents

Control method, device, equipment and storage medium for delay message Download PDF

Info

Publication number
CN112118297B
CN112118297B CN202010902483.XA CN202010902483A CN112118297B CN 112118297 B CN112118297 B CN 112118297B CN 202010902483 A CN202010902483 A CN 202010902483A CN 112118297 B CN112118297 B CN 112118297B
Authority
CN
China
Prior art keywords
target
delay
message
data
express
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202010902483.XA
Other languages
Chinese (zh)
Other versions
CN112118297A (en
Inventor
陈超
刘梦超
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Dongpu Software Co Ltd
Original Assignee
Dongpu Software 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 Dongpu Software Co Ltd filed Critical Dongpu Software Co Ltd
Priority to CN202010902483.XA priority Critical patent/CN112118297B/en
Publication of CN112118297A publication Critical patent/CN112118297A/en
Application granted granted Critical
Publication of CN112118297B publication Critical patent/CN112118297B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/56Provisioning of proxy services
    • H04L67/568Storing data temporarily at an intermediate stage, e.g. caching
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/55Push-based network services
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/60Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources
    • H04L67/62Establishing a time schedule for servicing the requests

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Information Transfer Between Computers (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The invention relates to the technical field of logistics management, and discloses a control method, a device, equipment and a storage medium of a delay message, which are used for improving the number of delay levels supported by a RocketMQ and improving the flexibility and the reliability of a delay message system. The control method of the delay message comprises the following steps: acquiring preset delay level data; scanning initial track data of the target express, wherein the initial track data are used for indicating cabinet-out data and cabinet-in data of the target express in an express cabinet; judging whether cabinet-out data exists in the initial track data; if the cabinet-out data does not exist in the initial track data, judging whether cabinet-in data exists in the initial track data; if the cabinet-entering data exist in the initial track data, calling a target delay message corresponding to the target express, caching the target delay message into a message queue RocketMQ, and setting a target delay level of the target delay message; and pushing the target delay message in the RocketMQ to the target terminal according to the target delay level and a preset time round algorithm.

Description

Control method, device, equipment and storage medium for delay message
Technical Field
The present invention relates to the field of logistics management technologies, and in particular, to a method, an apparatus, a device, and a storage medium for controlling a delay message.
Background
Along with the rapid development of online shopping, the express service is more and more humanized, after the express package is put into the express cabinet for two hours, the service of triggering the short message notification is not signed yet, in the past, the express company is realized through RabbitMQ, the RabbitMQ is realized based on a memory, the memory is easy to burst, the durability is not realized, and the data pushing requirement under a big data scene cannot be met.
If other Message Queues (MQ) are used, for example, rocketMQ, rocketMQ open source version is used to support the message processing of the delay level, but the default support level is limited, and only 12 levels are supported at maximum, which cannot meet the long-time delay scenario of the express service.
Disclosure of Invention
The invention provides a control method, a device, equipment and a storage medium of delay information, which are used for improving the number of delay levels supported by a RocketMQ and improving the flexibility and the reliability of a delay information system.
The first aspect of the present invention provides a method for controlling a delay message, including: acquiring preset delay level data, wherein the delay level data is used for indicating delay interval levels of delay messages, and the delay interval levels comprise a second level, a minute level, an hour level and a day level; scanning initial track data of a target express, wherein the initial track data are used for indicating cabinet-out data and cabinet-in data of the target express in an express cabinet; judging whether cabinet-out data exists in the initial track data; if the cabinet-out data does not exist in the initial track data, judging whether cabinet-in data exists in the initial track data; if the cabinet-entering data exist in the initial track data, calling a target delay message corresponding to the target express, caching the target delay message into a message queue RocketMQ, and setting a target delay level of the target delay message; pushing the target delay message in the RocketMQ to a target terminal according to the target delay level and a preset time round algorithm.
Optionally, in a first implementation manner of the first aspect of the present invention, before the obtaining delay level data, the delay level data is used to indicate a delay interval level of a delay message, the control method of the delay message further includes: and calling an Apollo configuration center to set a self-defined delay level, and loading the self-defined delay level as delay level data of a target delay level into a Broker cluster to obtain preset delay level data.
Optionally, in a second implementation manner of the first aspect of the present invention, pushing the target delay message in the dockmq to the target terminal according to the target delay level and a preset time round algorithm includes: acquiring consumption data corresponding to the target express according to the target delay level, wherein the consumption data is used for indicating express information corresponding to the target express; determining a target single number corresponding to the target express according to the express information; judging whether the target single number exists in a preset pika plug-in; if the target single number exists in the preset pika plug-in, determining a target terminal according to the target single number; and reading a target delay message from the RocketMQ through a preset time round algorithm and sending the target delay message to the target terminal.
Optionally, in a third implementation manner of the first aspect of the present invention, after the determining whether the target single number exists in the preset pika plugin, the control method of the delay message further includes: and if the target single number does not exist in the preset pika plug-in, terminating the message pushing flow of the target express.
Optionally, in a fourth implementation manner of the first aspect of the present invention, after the determining whether the cabinet output data exists in the initial track data, the control method of the delay message further includes: if the cabinet-out data exists in the initial track data, loading the cabinet-out data into a preset pika plug-in unit, and determining that the target express is finished to be cabinet-out; and deleting the target delay message corresponding to the target express, and terminating the message pushing flow of the target express.
Optionally, in a fifth implementation manner of the first aspect of the present invention, after the determining whether cabinet-in data exists in the initial track data, the control method of the delay message further includes: and if the initial track data does not contain the cabinet-entering data, terminating the message pushing flow of the target express.
A second aspect of the present invention provides a control apparatus for delaying a message, including: the acquisition module is used for acquiring preset delay level data, wherein the delay level data are used for indicating delay interval levels of delay messages, and the delay interval levels comprise a second level, a minute level, an hour level and a day level; the scanning module is used for reading initial track data of the target express, wherein the initial track data are used for indicating cabinet-out data and cabinet-in data of the target express in the express cabinet; the first judging module is used for judging whether cabinet-out data exist in the initial track data; the second judging module is used for judging whether cabinet-in data exist in the initial track data if cabinet-out data do not exist in the initial track data; the calling module is used for calling a target delay message corresponding to the target express if the cabinet-entering data exists in the initial track data, caching the target delay message into a message queue RocketMQ, and setting a target delay level of the target delay message; and the pushing module is used for pushing the target delay message in the RocketMQ to the target terminal according to the target delay level and a preset time round algorithm.
Optionally, in a first implementation manner of the second aspect of the present invention, the control device of the delay message further includes: the setting module is used for calling the Apollo configuration center to set a self-defined delay level, and loading the self-defined delay level serving as a target delay level to delay level data in the Broker cluster to obtain preset delay level data.
Optionally, in a second implementation manner of the second aspect of the present invention, the pushing module includes: the acquisition unit is used for acquiring consumption data corresponding to the target express according to the target delay level, wherein the consumption data is used for indicating express information corresponding to the target express; the first determining unit is used for determining a target single number corresponding to the target express according to the express information; a judging unit for judging whether the target single number exists in the preset pika plug-in; the second determining unit is used for determining a target terminal according to the target single number if the target single number exists in the preset pika plug-in; and the reading and sending unit is used for reading the target delay message from the RocketMQ through a preset time round algorithm and sending the target delay message to the target terminal.
Optionally, in a third implementation manner of the second aspect of the present invention, the pushing module further includes: and the termination unit is used for terminating the message pushing flow of the target express if the target single number does not exist in the preset pika plug-in.
Optionally, in a fourth implementation manner of the second aspect of the present invention, the control device of the delay message further includes: the loading module is used for loading the cabinet-out data into a preset pika plug-in if the cabinet-out data exists in the initial track data, and determining that the target express is finished; and the deleting module is used for deleting the target delay message corresponding to the target express and terminating the message pushing flow of the target express.
Optionally, in a fifth implementation manner of the second aspect of the present invention, the control device for delaying a message further includes: and the termination module is used for terminating the message pushing flow of the target express if the cabinet-entering data does not exist in the initial track data.
A third aspect of the present invention provides a control device for delaying a message, comprising: a memory and at least one processor, the memory having instructions stored therein, the memory and the at least one processor being interconnected by a line; the at least one processor invokes the instructions in the memory to cause the control device of the delayed message to perform the control method of the delayed message described above.
A fourth aspect of the present invention provides a computer readable storage medium having instructions stored therein which, when run on a computer, cause the computer to perform the above-described method of controlling a delay message.
In the technical scheme provided by the invention, preset delay level data are acquired, and the delay level data are used for indicating delay interval levels of delay messages, wherein the delay interval levels comprise a second level, a minute level, an hour level and a day level; scanning initial track data of the target express, wherein the initial track data are used for indicating cabinet-out data and cabinet-in data of the target express in an express cabinet; judging whether cabinet-out data exists in the initial track data; if the cabinet-out data does not exist in the initial track data, judging whether cabinet-in data exists in the initial track data; if the cabinet-entering data exist in the initial track data, calling a target delay message corresponding to the target express, caching the target delay message into a message queue RocketMQ, and setting a target delay level of the target delay message; and pushing the target delay message in the RocketMQ to the target terminal according to the target delay level and a preset time round algorithm. In the embodiment of the invention, the message queue of the RocketMQ is controlled through a time round algorithm, the parameter standard of the delay message level is adjusted, the number of delay levels supported by the RocketMQ is increased, and the flexibility and the reliability of a delay message system are improved.
Drawings
FIG. 1 is a schematic diagram of an embodiment of a control method for a delay message according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of another embodiment of a control method of a delay message in an embodiment of the present invention;
FIG. 3 is a schematic diagram of an embodiment of a control device for delaying messages according to an embodiment of the present invention;
FIG. 4 is a schematic diagram of another embodiment of a control device for delaying messages according to an embodiment of the present invention;
fig. 5 is a schematic diagram of an embodiment of a control device for delaying a message in an embodiment of the present invention.
Detailed Description
The embodiment of the invention provides a control method, a device, equipment and a storage medium of delay messages, which are used for improving the number of delay levels supported by a RocketMQ and improving the flexibility and the reliability of a delay message cluster.
The terms "first," "second," "third," "fourth" and the like in the description and in the claims and in the above drawings, if any, are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments described herein may be implemented in other sequences than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed or inherent to such process, method, article, or apparatus.
For easy understanding, the following describes a specific flow of an embodiment of the present invention, referring to fig. 1, and one embodiment of a method for controlling a delay message in an embodiment of the present invention includes:
101. and acquiring preset delay level data, wherein the delay level data is used for indicating delay interval levels of delay messages, and the delay interval levels comprise a second level, a minute level, an hour level and a day level.
The server acquires preset delay level data, wherein the delay level data is used for indicating delay interval levels of delay messages, and the delay interval levels comprise a second level, a minute level, an hour level and a day level. For the express service scenario, the second level and the grading are generally not needed, for example, if an express (express) is put into the express cabinet by an express person for more than 2 hours, the server should inform the user to take the express, and if the express is not taken out from the express cabinet for more than 12 hours or 24 hours, a prompt message needs to be sent to the user again. In addition, for the express item with serious timeout, the customer can be charged additional keeping fee according to the actual situation, and the method is not limited herein.
In this embodiment, the delay message (notification message) of the express item is generally in units of hours, and for example, the delay interval level includes 30s, 1m, 10m, 30m, 1h, 2h, 4h, 8h, 10h, 12h, 14h, 18h, 1d, 2d, 3d, 4d, and 5d.
It can be understood that the execution body of the present invention may be a control device for delaying a message, and may also be a terminal or a server, which is not limited herein. The embodiment of the invention is described by taking a server as an execution main body as an example.
102. And scanning initial track data of the target express, wherein the initial track data is used for indicating cabinet-out data and cabinet-in data of the target express in the express cabinet.
The server scans initial track data of the target express, wherein the initial track data is used for indicating cabinet-out data and cabinet-in data of the target express in the express cabinet.
When the express mail is put into the express cabinet by an express delivery person, the express cabinet records the putting time and the single number corresponding to the express mail, and then the cabinet-entering data is obtained; when the express mail is taken out from the express cabinet, the express cabinet can record the taking-out time and the corresponding single number of the express mail, and then the cabinet-out data are obtained.
103. And judging whether cabinet-out data exists in the initial track data.
The server judges whether cabinet-out data exists in the initial track data. The server can find out the cabinet data from the initial track data corresponding to the target express. If the initial track data contains cabinet-out data, namely, the target express mail is put into the express cabinet, and the express cabinet is taken out by the user within a specified duration, the target delay message (namely, the prompt message) is not required to be sent to the user.
104. If the cabinet-in data does not exist in the initial track data, judging whether cabinet-in data exists in the initial track data.
If the cabinet-in data does not exist in the initial track data, the server judges whether cabinet-in data exists in the initial track data. If the cabinet-out data does not exist, namely the target express mail is possibly still in the express cabinet or is not put into the express cabinet, the server needs to carry out further confirmation, namely scanning initial track data, and judging whether the cabinet-in data exists or not. If the initial track data contains the cabinet entering data, the target express mail is indicated to be put into the express cabinet by the express delivery person, and a delay message of the target express mail can be set; if the initial track data does not contain the in-cabinet data, the target express is not put into the express cabinet by the express delivery person, and the process is ended without pushing the message.
105. And if the cabinet-entering data exists in the initial track data, calling a target delay message corresponding to the target express, caching the target delay message into a message queue RocketMQ, and setting a target delay level of the target delay message.
If the cabinet-entering data exists in the initial track data, the server calls a target delay message corresponding to the target express, caches the target delay message into a message queue RocketMQ, and sets a target delay level of the target delay message.
It can be understood that when the target express mail is put into the express cabinet, after the cabinet-entering data is generated, the server starts timing, and reminds the user to take the express mail or charge according to the length of the cabinet-entering time length.
It should be noted that, the candidate delay interval levels include 30s, 1m, 10m, 30m, 1h, 2h, 4h, 8h, 10h, 12h, 14h, 18h, 1d, 2d, 3d, 4d, and 5d, for example, the target delay level corresponding to the target express is set to 2h, and then the target delay message corresponding to the target express sends the target delay message to the client after 2h, that is, sends the delay message to the client terminal to remind the client to complete the express fetching.
106. And pushing the target delay message in the RocketMQ to the target terminal according to the target delay level and a preset time round algorithm.
And pushing the target delay message in the RocketMQ to the target terminal by the server according to the target delay level and a preset time round algorithm.
Specifically, the server acquires consumption data corresponding to the target express according to the target delay level, wherein the consumption data is used for indicating express information corresponding to the target express; the server determines a target single number corresponding to the target express according to the express information; the server judges whether a target single number exists in a preset pika plug-in; if the target single number exists in the preset pika plug-in, the server determines a target terminal according to the target single number; the server reads the target delay message from the RocketMQ through a preset time round algorithm and sends the target delay message to the target terminal. The RocketMQ controls the target delay message through a plurality of layers of time wheels, wherein the read message and the write message are separated, namely the enqueue operation and the dequeue operation are separated, and the read message and the write message are not mutually influenced.
It should be noted that, the original RocketMQ delay engine puts the delay level information of the message into the delay message queue through the own ScheduledMessage, thereby reducing the overhead of the system. In this embodiment, a multi-stage time wheel (i.e. a time wheel algorithm) is used to manage the delay message, and the application Only principle is followed. Each record contains a prev_pos pointing to the record timed to the same time instant. Each record may contain the delay message itself, or may contain only the position information of the delay message, and the TimerLog records only the position information, and the actual message is stored in the CommitLog. The RocketMQ multiplexes the high availability of CommitLog in the MQ. Each duplicate node establishes its own timerWheeel and timerLog according to CommitLog, and it should be noted that all nodes (master node and slave node) perform the enqueue process, but only the master node performs the dequeue process.
In this embodiment, the TimerLog and timerluel implement management of the delay message: the multi-level time wheel comprises an inner layer TimerWheeel and an outer layer TimerWheeel, wherein adjacent Tick contents are mainly merged, for example, every 60 adjacent Ticks, namely 1 minute of contents are stored as a file, the contents of 1 minute are loaded into the inner layer TimerWheeel in a memory for sorting when required, and the Tick can be set to be 1 minute by the outer layer TimerWheeel. Tick represents the smallest time scale.
Enqueue operation: refers to the process of writing TimerWheel and TimerLog.
The server reads the position (no-1) of the last message timed to the same time from the TimerWheel according to the timing time, adds the position and the message related information to the TimerLog, and simultaneously modifies the TimerWheel pointing relation.
Dequeue operation: refers to the process of reading out TimerWheel and TimerLog.
The server finds the corresponding position in the TimerLog from TimerWheeel, and then reads out each message in turn according to the pointing relation and delivers the message to the user.
It will be appreciated that the window of timerWheel is limited, in this embodiment timerWheel defaults to 7 days, in order to achieve infinite timing time, the message is scrolled in; for example, the timing is 30 days, the rolling is set to be once for 7 days, the initial delay of the message is set to be 7 days, the message enters a time wheel, when the message comes out from the time wheel, the message is judged to be the rolling message, and the message is not delivered to a consumer (a terminal corresponding to a user) but is produced into new information, the delay is set to be 7 days, and the message enters the time wheel again; the operation is cycled until final expiration. In this example, the delay is 30 days, then scrolling can be done every 7 days, 5 times, and finally delivered to the consumer.
In the embodiment of the invention, the message queue of the RocketMQ is controlled through a time round algorithm, the parameter standard of the delay message level is adjusted, the number of delay levels supported by the RocketMQ is increased, and the flexibility and the reliability of a delay message system are improved.
Referring to fig. 2, another embodiment of a method for controlling a delay message in an embodiment of the present invention includes:
201. and calling an Apollo configuration center to set a self-defined delay level, and loading the self-defined delay level as delay level data of a target delay level into a Broker cluster to obtain preset delay level data.
The server calls an Apollo configuration center to set a self-defined delay level, and loads the self-defined delay level as delay level data of a target delay level into a Broker cluster to obtain preset delay level data.
It should be noted that, the configuration accesses Apollo, supports the delay level of the dynamic modification message. If the delay level needed by the service is not contained in the default delay level, the delay level can be dynamically increased by Apollo, so that the dynamic expansion of the service is satisfied. In the embodiment, the problem that the self-defined level delay message cannot be supported in the original open source RocketMQ is solved by introducing Apollo to realize synchronous updating of the configuration file.
202. And acquiring preset delay level data, wherein the delay level data is used for indicating delay interval levels of delay messages, and the delay interval levels comprise a second level, a minute level, an hour level and a day level.
The server acquires preset delay level data, wherein the delay level data is used for indicating delay interval levels of delay messages, and the delay interval levels comprise a second level, a minute level, an hour level and a day level. For the express service scenario, the second level and the grading are generally not needed, for example, if an express (express) is put into the express cabinet by an express person for more than 2 hours, the server should inform the user to take the express, and if the express is not taken out from the express cabinet for more than 12 hours or 24 hours, a prompt message needs to be sent to the user again. In addition, for the express item with serious timeout, the customer can be charged additional keeping fee according to the actual situation, and the method is not limited herein.
In this embodiment, the delay message (notification message) of the express item is generally in units of hours, and for example, the delay interval level includes 30s, 1m, 10m, 30m, 1h, 2h, 4h, 8h, 10h, 12h, 14h, 18h, 1d, 2d, 3d, 4d, and 5d.
It can be understood that the execution body of the present invention may be a control device for delaying a message, and may also be a terminal or a server, which is not limited herein. The embodiment of the invention is described by taking a server as an execution main body as an example.
203. And scanning initial track data of the target express, wherein the initial track data is used for indicating cabinet-out data and cabinet-in data of the target express in the express cabinet.
The server scans initial track data of the target express, wherein the initial track data is used for indicating cabinet-out data and cabinet-in data of the target express in the express cabinet.
When the express mail is put into the express cabinet by an express delivery person, the express cabinet records the putting time and the single number corresponding to the express mail, and then the cabinet-entering data is obtained; when the express mail is taken out from the express cabinet, the express cabinet can record the taking-out time and the corresponding single number of the express mail, and then the cabinet-out data are obtained.
204. And judging whether cabinet-out data exists in the initial track data.
The server judges whether cabinet-out data exists in the initial track data. The server can find out the cabinet data from the initial track data corresponding to the target express. If the initial track data contains cabinet-out data, namely, the target express mail is put into the express cabinet, and the express cabinet is taken out by the user within a specified duration, the target delay message (namely, the prompt message) is not required to be sent to the user.
205. If the cabinet-in data does not exist in the initial track data, judging whether cabinet-in data exists in the initial track data.
If the cabinet-in data does not exist in the initial track data, the server judges whether cabinet-in data exists in the initial track data. If the cabinet-out data does not exist, namely the target express mail is possibly still in the express cabinet or is not put into the express cabinet, the server needs to carry out further confirmation, namely scanning initial track data, and judging whether the cabinet-in data exists or not. If the initial track data contains the cabinet entering data, the target express mail is indicated to be put into the express cabinet by the express delivery person, and a delay message of the target express mail can be set; if the initial track data does not contain the in-cabinet data, the target express is not put into the express cabinet by the express delivery person, and the process is ended without pushing the message.
Optionally, the control method of the delay message further includes:
if the cabinet-out data exists in the initial track data, the server loads the cabinet-out data into a preset pika plugin, and determines that the target express is finished; and deleting the target delay message corresponding to the target express, and terminating the message pushing flow of the target express.
206. And if the cabinet-entering data exists in the initial track data, calling a target delay message corresponding to the target express, caching the target delay message into a message queue RocketMQ, and setting a target delay level of the target delay message.
If the cabinet-entering data exists in the initial track data, the server calls a target delay message corresponding to the target express, caches the target delay message into a message queue RocketMQ, and sets a target delay level of the target delay message.
It can be understood that when the target express mail is put into the express cabinet, after the cabinet-entering data is generated, the server starts timing, and reminds the user to take the express mail or charge according to the length of the cabinet-entering time length.
It should be noted that, the candidate delay interval levels include 30s, 1m, 10m, 30m, 1h, 2h, 4h, 8h, 10h, 12h, 14h, 18h, 1d, 2d, 3d, 4d, and 5d, for example, the target delay level corresponding to the target express is set to 2h, and then the target delay message corresponding to the target express sends the target delay message to the client after 2h, that is, sends the delay message to the client terminal to remind the client to complete the express fetching.
Optionally, the control method of the delay message further includes:
If the initial track data does not contain the cabinet-entering data, the server terminates the message pushing flow of the target express.
207. And pushing the target delay message in the RocketMQ to the target terminal according to the target delay level and a preset time round algorithm.
And pushing the target delay message in the RocketMQ to the target terminal by the server according to the target delay level and a preset time round algorithm.
Specifically, the server acquires consumption data corresponding to the target express according to the target delay level, wherein the consumption data is used for indicating express information corresponding to the target express; the server determines a target single number corresponding to the target express according to the express information; the server judges whether a target single number exists in a preset pika plug-in; if the target single number exists in the preset pika plug-in, the server determines a target terminal according to the target single number; the server reads the target delay message from the RocketMQ through a preset time round algorithm and sends the target delay message to the target terminal. The RocketMQ controls the target delay message through a plurality of layers of time wheels, wherein the read message and the write message are separated, namely the enqueue operation and the dequeue operation are separated, and the read message and the write message are not mutually influenced.
Optionally, the control method of the delay message further includes:
If the target single number does not exist in the preset pika plug-in, the server terminates the message pushing flow of the target express.
It should be noted that, the original RocketMQ delay engine puts the delay level information of the message into the delay message queue through the own ScheduledMessage, thereby reducing the overhead of the system. In this embodiment, a multi-stage time wheel (i.e. a time wheel algorithm) is used to manage the delay message, and the application Only principle is followed. Each record contains a prev_pos pointing to the record timed to the same time instant. Each record may contain the delay message itself, or may contain only the position information of the delay message, and the TimerLog records only the position information, and the actual message is stored in the CommitLog. The RocketMQ multiplexes the high availability of CommitLog in the MQ. Each duplicate node establishes its own timerWheeel and timerLog according to CommitLog, and it should be noted that all nodes (master node and slave node) perform the enqueue process, but only the master node performs the dequeue process.
In this embodiment, the TimerLog and timerluel implement management of the delay message: the multi-level time wheel comprises an inner layer TimerWheeel and an outer layer TimerWheeel, wherein adjacent Tick contents are mainly merged, for example, every 60 adjacent Ticks, namely 1 minute of contents are stored as a file, the contents of 1 minute are loaded into the inner layer TimerWheeel in a memory for sorting when required, and the Tick can be set to be 1 minute by the outer layer TimerWheeel. Tick represents the smallest time scale.
Enqueue operation: refers to the process of writing TimerWheel and TimerLog.
The server reads the position (no-1) of the last message timed to the same time from the TimerWheel according to the timing time, adds the position and the message related information to the TimerLog, and simultaneously modifies the TimerWheel pointing relation.
Dequeue operation: refers to the process of reading out TimerWheel and TimerLog.
The server finds the corresponding position in the TimerLog from TimerWheeel, and then reads out each message in turn according to the pointing relation and delivers the message to the user.
It will be appreciated that the window of timerWheel is limited, in this embodiment timerWheel defaults to 7 days, in order to achieve infinite timing time, the message is scrolled in; for example, the timing is 30 days, the rolling is set to be once for 7 days, the initial delay of the message is set to be 7 days, the message enters a time wheel, when the message comes out from the time wheel, the message is judged to be the rolling message, and the message is not delivered to a consumer (a terminal corresponding to a user) but is produced into new information, the delay is set to be 7 days, and the message enters the time wheel again; the operation is cycled until final expiration. In this example, the delay is 30 days, then scrolling can be done every 7 days, 5 times, and finally delivered to the consumer.
In the embodiment of the invention, the message queue of the RocketMQ is controlled through a time round algorithm, the parameter standard of the delay message level is adjusted, and the synchronous update of the configuration file is realized through introducing Apollo, so that the self-defined level delay message is supported, the number of delay levels supported by the RocketMQ is increased, and the flexibility and the reliability of a delay message system are improved.
The method for controlling the delay message in the embodiment of the present invention is described above, and the following describes a device for controlling the delay message in the embodiment of the present invention, referring to fig. 3, one embodiment of the device for controlling the delay message in the embodiment of the present invention includes:
the obtaining module 301 is configured to obtain preset delay level data, where the delay level data is used to indicate a delay interval level of a delay message, and the delay interval level includes a second level, a minute level, an hour level, and a day level;
the scanning module 302 is configured to read initial track data of the target express, where the initial track data is used to indicate cabinet-out data and cabinet-in data of the target express in the express cabinet;
a first judging module 303, configured to judge whether cabinet output data exists in the initial track data;
The second judging module 304 is configured to judge whether cabinet-in data exists in the initial track data if cabinet-out data does not exist in the initial track data;
a calling module 305, configured to call a target delay message corresponding to the target express if the cabinet-entering data exists in the initial track data, cache the target delay message in a message queue RocketMQ, and set a target delay level of the target delay message;
and the pushing module 306 is configured to push the target delay message in the dockmq to the target terminal according to the target delay level and a preset time round algorithm.
In the embodiment of the invention, the message queue of the RocketMQ is controlled through a time round algorithm, the parameter standard of the delay message level is adjusted, the number of delay levels supported by the RocketMQ is increased, and the flexibility and the reliability of a delay message system are improved.
Referring to fig. 4, another embodiment of a control device for a delay message in an embodiment of the present invention includes:
the obtaining module 301 is configured to obtain preset delay level data, where the delay level data is used to indicate a delay interval level of a delay message, and the delay interval level includes a second level, a minute level, an hour level, and a day level;
The scanning module 302 is configured to read initial track data of the target express, where the initial track data is used to indicate cabinet-out data and cabinet-in data of the target express in the express cabinet;
a first judging module 303, configured to judge whether cabinet output data exists in the initial track data;
the second judging module 304 is configured to judge whether cabinet-in data exists in the initial track data if cabinet-out data does not exist in the initial track data;
a calling module 305, configured to call a target delay message corresponding to the target express if the cabinet-entering data exists in the initial track data, cache the target delay message in a message queue RocketMQ, and set a target delay level of the target delay message;
and the pushing module 306 is configured to push the target delay message in the dockmq to the target terminal according to the target delay level and a preset time round algorithm.
Optionally, the control device of the delay message further includes:
the setting module 307 is configured to invoke the Apollo configuration center to set a custom delay level, and load the custom delay level as delay level data of a target delay level into a Broker cluster, so as to obtain preset delay level data.
Optionally, the pushing module 306 includes:
the acquiring unit 3061 is configured to acquire consumption data corresponding to the target express according to the target delay level, where the consumption data is used to indicate express information corresponding to the target express;
a first determining unit 3062, configured to determine, according to the express information, a target single number corresponding to the target express;
a judging unit 3063, configured to judge whether the target single number exists in the preset pika plugin;
the second determining unit 3064 is configured to determine a target terminal according to the target single number if the target single number exists in the preset pika plug-in;
and the reading and sending unit 3065 is used for reading the target delay message from the RocketMQ through a preset time round algorithm and sending the target delay message to the target terminal.
Optionally, the pushing module 306 further includes:
and a termination unit 3066, configured to terminate the message pushing flow of the target express if the target single number does not exist in the preset pika plug-in.
Optionally, the control device of the delay message further includes:
the loading module 308 is configured to load the outbound data into a preset pika plugin if the outbound data exists in the initial track data, and determine that the target express has completed outbound;
And the deleting module 309 is configured to delete the target delay message corresponding to the target express, and terminate the message pushing flow of the target express.
Optionally, the control device of the delay message further includes:
and a termination module 310, configured to terminate the message pushing flow of the target express if the in-cabinet data does not exist in the initial track data.
In the embodiment of the invention, the message queue of the RocketMQ is controlled through a time round algorithm, the parameter standard of the delay message level is adjusted, and the synchronous update of the configuration file is realized through introducing Apollo, so that the self-defined level delay message is supported, the number of delay levels supported by the RocketMQ is increased, and the flexibility and the reliability of a delay message system are improved.
The control device for the delay message in the embodiment of the present invention is described in detail above in fig. 3 and fig. 4 from the point of view of modularized functional entities, and the control device for the delay message in the embodiment of the present invention is described in detail below from the point of view of hardware processing.
Fig. 5 is a schematic structural diagram of a control device for delay messages according to an embodiment of the present invention, where the control device 500 for delay messages may have a relatively large difference due to different configurations or performances, and may include one or more processors (central processing units, CPU) 510 (e.g., one or more processors) and a memory 520, and one or more storage media 530 (e.g., one or more mass storage devices) storing application programs 533 or data 532. Wherein memory 520 and storage medium 530 may be transitory or persistent storage. The program stored in the storage medium 530 may include one or more modules (not shown), each of which may include a series of instruction operations in the control device 500 for the delay message. Still further, the processor 510 may be arranged to communicate with the storage medium 530 and to execute a series of instruction operations in the storage medium 530 on the control device 500 of the delay message.
The control device 500 for the delayed messages may also include one or more power supplies 540, one or more wired or wireless network interfaces 550, one or more input/output interfaces 560, and/or one or more operating systems 531, such as Windows Serve, mac OS X, unix, linux, freeBSD, and the like. It will be appreciated by those skilled in the art that the control device structure of the delay message shown in fig. 5 does not constitute a limitation of the control device of the delay message, and may include more or less components than illustrated, or may combine certain components, or may be a different arrangement of components.
The present invention also provides a computer readable storage medium, which may be a non-volatile computer readable storage medium, or a volatile computer readable storage medium, having stored therein instructions that, when executed on a computer, cause the computer to perform the steps of the method for controlling a delay message.
It will be clear to those skilled in the art that, for convenience and brevity of description, specific working procedures of the above-described systems, apparatuses and units may refer to corresponding procedures in the foregoing method embodiments, which are not repeated herein.
The integrated units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied essentially or in part or all of the technical solution or in part in the form of a software product stored in a storage medium, including instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a read-only memory (ROM), a random access memory (random access memory, RAM), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
The above embodiments are only for illustrating the technical solution of the present invention, and not for limiting the same; although the invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims (10)

1. The control method of the delay message is characterized by comprising the following steps:
calling an Apollo configuration center to set a self-defined delay level, and loading the self-defined delay level as delay level data of a target delay level into a Broker cluster to obtain preset delay level data;
acquiring preset delay level data, wherein the delay level data is used for indicating delay interval levels of delay messages, and the delay interval levels comprise a second level, a minute level, an hour level and a day level;
scanning initial track data of a target express, wherein the initial track data are used for indicating cabinet-out data and cabinet-in data of the target express in an express cabinet;
judging whether cabinet-out data exists in the initial track data;
if the cabinet-out data does not exist in the initial track data, judging whether cabinet-in data exists in the initial track data;
if the cabinet-entering data exist in the initial track data, calling a target delay message corresponding to the target express, caching the target delay message into a message queue RocketMQ, and setting a target delay level of the target delay message;
Pushing the target delay message in the RocketMQ to a target terminal according to the target delay level and a preset time round algorithm.
2. The method for controlling the delay message according to claim 1, wherein pushing the target delay message in the dockmq to the target terminal according to the target delay level and a preset time round algorithm comprises:
acquiring consumption data corresponding to the target express according to the target delay level, wherein the consumption data is used for indicating express information corresponding to the target express;
determining a target single number corresponding to the target express according to the express information;
judging whether the target single number exists in a preset pika plug-in;
if the target single number exists in the preset pika plug-in, determining a target terminal according to the target single number;
and reading a target delay message from the RocketMQ through a preset time round algorithm and sending the target delay message to the target terminal.
3. The control method of a delay message according to claim 2, wherein after said judging whether the target single number exists in the preset pika plugin, the control method of a delay message further comprises:
And if the target single number does not exist in the preset pika plug-in, terminating the message pushing flow of the target express.
4. The method for controlling a delay message according to claim 1, wherein after said determining whether there is cabinet-out data in the initial trajectory data, the method for controlling a delay message further comprises:
if the cabinet-out data exists in the initial track data, loading the cabinet-out data into a preset pika plug-in unit, and determining that the target express is finished to be cabinet-out;
and deleting the target delay message corresponding to the target express, and terminating the message pushing flow of the target express.
5. The method for controlling a delay message according to claim 1, wherein after said determining whether there is cabinet-in data in the initial trajectory data, the method for controlling a delay message further comprises:
and if the initial track data does not contain the cabinet-entering data, terminating the message pushing flow of the target express.
6. A control device for a delayed message, wherein the control device for a delayed message comprises:
the setting module is used for calling an Apollo configuration center to set a self-defined delay level, and loading the self-defined delay level serving as a target delay level to delay level data in a Broker cluster to obtain preset delay level data;
The acquisition module is used for acquiring preset delay level data, wherein the delay level data are used for indicating delay interval levels of delay messages, and the delay interval levels comprise a second level, a minute level, an hour level and a day level;
the scanning module is used for reading initial track data of the target express, wherein the initial track data are used for indicating cabinet-out data and cabinet-in data of the target express in the express cabinet;
the first judging module is used for judging whether cabinet-out data exist in the initial track data;
the second judging module is used for judging whether cabinet-in data exist in the initial track data if cabinet-out data do not exist in the initial track data;
the calling module is used for calling a target delay message corresponding to the target express if the cabinet-entering data exists in the initial track data, caching the target delay message into a message queue RocketMQ, and setting a target delay level of the target delay message;
and the pushing module is used for pushing the target delay message in the RocketMQ to the target terminal according to the target delay level and a preset time round algorithm.
7. The control device for delaying messages according to claim 6, wherein the push module comprises:
The acquisition unit is used for acquiring consumption data corresponding to the target express according to the target delay level, wherein the consumption data is used for indicating express information corresponding to the target express;
the first determining unit is used for determining a target single number corresponding to the target express according to the express information; a judging unit for judging whether the target single number exists in the preset pika plug-in;
the second determining unit is used for determining a target terminal according to the target single number if the target single number exists in the preset pika plug-in;
and the reading and sending unit is used for reading the target delay message from the RocketMQ through a preset time round algorithm and sending the target delay message to the target terminal.
8. The control device for delaying messages according to claim 7, wherein the push module further comprises:
and the termination unit is used for terminating the message pushing flow of the target express if the target single number does not exist in the preset pika plug-in.
9. A control device for delaying a message, the control device for delaying a message comprising: a memory and at least one processor, the memory having instructions stored therein, the memory and the at least one processor being interconnected by a line;
The at least one processor invokes the instructions in the memory to cause the control device of the delayed message to perform the method of controlling a delayed message as claimed in any of claims 1-5.
10. A computer readable storage medium having instructions stored thereon, which when executed by a processor implement the method of controlling a time delay message according to any of claims 1-5.
CN202010902483.XA 2020-09-01 2020-09-01 Control method, device, equipment and storage medium for delay message Active CN112118297B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010902483.XA CN112118297B (en) 2020-09-01 2020-09-01 Control method, device, equipment and storage medium for delay message

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010902483.XA CN112118297B (en) 2020-09-01 2020-09-01 Control method, device, equipment and storage medium for delay message

Publications (2)

Publication Number Publication Date
CN112118297A CN112118297A (en) 2020-12-22
CN112118297B true CN112118297B (en) 2024-03-26

Family

ID=73805083

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010902483.XA Active CN112118297B (en) 2020-09-01 2020-09-01 Control method, device, equipment and storage medium for delay message

Country Status (1)

Country Link
CN (1) CN112118297B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115022263A (en) * 2022-06-02 2022-09-06 政采云有限公司 Delivery method, device, equipment and storage medium of delay message
CN116503973B (en) * 2023-06-20 2023-08-29 厦门星拉科技有限公司 Intelligent power equipment inspection system and method based on electric power Internet of things

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108415759A (en) * 2017-02-09 2018-08-17 阿里巴巴集团控股有限公司 Processing method, device and the electronic equipment of message
US10127615B1 (en) * 2016-06-14 2018-11-13 Chicago Stock Exchange, Inc. System and method for delaying an executable instruction that would otherwise be executable immediately upon arrival at an executing system
CN109684108A (en) * 2018-12-26 2019-04-26 江苏满运软件科技有限公司 Implementation method, system, storage medium and the electronic equipment of message queue
CN109743137A (en) * 2019-01-10 2019-05-10 浙江小泰科技有限公司 A kind of Distributed Delay message queue processing system for supporting to update
CN110139229A (en) * 2019-04-15 2019-08-16 平安科技(深圳)有限公司 Delay sends method, apparatus, computer equipment and the storage medium of short message
CN110719318A (en) * 2019-09-06 2020-01-21 上海陆家嘴国际金融资产交易市场股份有限公司 Message processing method and system
CN111124653A (en) * 2019-12-31 2020-05-08 江苏满运软件科技有限公司 Delayed message processing method, system, device and storage medium

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10127615B1 (en) * 2016-06-14 2018-11-13 Chicago Stock Exchange, Inc. System and method for delaying an executable instruction that would otherwise be executable immediately upon arrival at an executing system
CN108415759A (en) * 2017-02-09 2018-08-17 阿里巴巴集团控股有限公司 Processing method, device and the electronic equipment of message
CN109684108A (en) * 2018-12-26 2019-04-26 江苏满运软件科技有限公司 Implementation method, system, storage medium and the electronic equipment of message queue
CN109743137A (en) * 2019-01-10 2019-05-10 浙江小泰科技有限公司 A kind of Distributed Delay message queue processing system for supporting to update
CN110139229A (en) * 2019-04-15 2019-08-16 平安科技(深圳)有限公司 Delay sends method, apparatus, computer equipment and the storage medium of short message
CN110719318A (en) * 2019-09-06 2020-01-21 上海陆家嘴国际金融资产交易市场股份有限公司 Message processing method and system
CN111124653A (en) * 2019-12-31 2020-05-08 江苏满运软件科技有限公司 Delayed message processing method, system, device and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
一种基于时间轮机制的软件定时器算法;高光;王宁;;鄂州大学学报(05);全文 *

Also Published As

Publication number Publication date
CN112118297A (en) 2020-12-22

Similar Documents

Publication Publication Date Title
EP3576036A1 (en) Service execution method and device
CN111782414B (en) Delay message processing method and system
TW202016815A (en) Method, apparatus and system for executing block chain transaction in parallelized manner
CN108055343B (en) Data synchronization method and device for computer room
CN112118297B (en) Control method, device, equipment and storage medium for delay message
US8903925B2 (en) Scheduled messages in a scalable messaging system
CN104657483B (en) Handle method, processing node, Centroid and the cluster of affairs
EP3565219B1 (en) Service execution method and device
CN107241380B (en) Method and apparatus for time-based adjusted load balancing
CN110968431B (en) Message processing method, device and equipment
US9038093B1 (en) Retrieving service request messages from a message queue maintained by a messaging middleware tool based on the origination time of the service request message
CN111221638B (en) Concurrent task scheduling processing method, device, equipment and medium
CN102129425A (en) Method and device for accessing large-object set table in data warehouse
CN112787958B (en) Delay message processing method and device
CN115062226A (en) User behavior integral analysis method and device, computer equipment and storage medium
CN106202082A (en) The method and device of built-up foundation data buffer storage
CN106202307A (en) A kind of batch log preservation method and device
CN108399175B (en) Data storage and query method and device
CN108833505B (en) Data request processing method, server and storage medium
EP3945420A1 (en) Method and apparatus for data processing, server and storage medium
CN110764930B (en) Request or response processing method and device based on message mode
CN113743879A (en) Automatic rule processing method, system and related equipment
CN115002187B (en) Binding relation processing method and related equipment
CN110545296A (en) Log data acquisition method, device and equipment
US20130145013A1 (en) Communication terminal and content update method

Legal Events

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