Message processing method, cloud platform, computing device, computer readable storage medium, and computer program product
Through the multi-level time dimension storage file structure and sequential reading method, the problems of limited storage time range and low reading efficiency of scheduled messages are solved, and efficient scheduled message delivery and storage are achieved.
Patent Information
- Application Number
- PCT/IB2025/051932
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-03-25
- Filing Date
- 2025-02-24
- Publication Date
- 2025-10-02
Smart Images

Figure IB2025051932_02102025_PF_FP_ABST
Abstract
Description
[0001] This disclosure claims priority to Chinese patent application number 202410352079.8, filed with the China Patent Office on March 25, 2024, and entitled "Message Processing Method, Cloud Platform, Computing Device, Computer-Readable Storage Medium, and Computer Program Product," the entire contents of which are incorporated herein by reference. Technical Field: Embodiments of the present disclosure relate to the field of computer technology, and more particularly to a message processing method, cloud platform, computing device, computer-readable storage medium, and computer program product. Background: The current Internet environment has a significant demand for scheduled messaging applications. Scheduled messages are delivered by a server to a consumer at a fixed time based on the message's set timer. Due to the delivery characteristics of scheduled messages, the content of scheduled messages is currently often stored in a commitlog file on disk or in a database, and is accessed using a random read method by setting a message index. However, the time range for storing scheduled messages based on current storage methods is very limited, resulting in serious write amplification problems and low message reading efficiency, which can easily cause delays in scheduled message delivery and page cache pollution. In view of this, embodiments of the present disclosure provide a message processing method. One or more embodiments of the present disclosure also relate to a cloud platform, a message processing apparatus, a computing device, a computer-readable storage medium, and a computer program product to address technical deficiencies in the prior art. According to a first aspect of an embodiment of the present disclosure, a message processing method is provided, comprising: obtaining a first scheduled message; based on the current delay time of the first scheduled message, searching for a first storage file corresponding to a first time dimension to which the current delay time belongs, wherein each level of the time dimension is provided with multiple independent storage files, and the current delay time refers to the delayed processing time of the first scheduled message relative to the current time point; and writing the first scheduled message to the first storage file. According to a second aspect of an embodiment of the present disclosure, a message processing method is provided, comprising: monitoring timed messages stored in storage files corresponding to time dimensions at each level, wherein each time dimension at each level is configured to correspond to multiple independent storage files; and, when a second timed message stored in a storage file corresponding to a target time dimension expires, sending the second timed message to a second storage file corresponding to a next-level time dimension in descending order of the time dimensions, wherein the target time dimension is any one of the time dimensions at each level.According to a third aspect of an embodiment of the present disclosure, a cloud platform is provided, comprising a control terminal and a storage space, wherein the storage space is configured with multiple independent storage files corresponding to time dimensions at different levels. The control terminal is configured to obtain a first scheduled message; search, based on a current delay time of the first scheduled message, for a first storage file corresponding to the first time dimension to which the current delay time belongs, wherein the current delay time refers to the delayed processing time of the first scheduled message relative to the current time point; and write the first scheduled message into the first storage file. According to a fourth aspect of an embodiment of the present disclosure, a message processing device is provided, comprising: an acquisition module configured to obtain the first scheduled message; a search module configured to search, based on the current delay time of the first scheduled message, for a first storage file corresponding to the first time dimension to which the current delay time belongs, wherein multiple independent storage files are configured for each time dimension at each level, wherein the current delay time refers to the delayed processing time of the first scheduled message relative to the current time point; and a write module configured to write the first scheduled message into the first storage file. According to a fifth aspect of an embodiment of the present disclosure, a message processing apparatus is provided, comprising: a monitoring module configured to monitor timed messages stored in storage files corresponding to time dimensions at each level, wherein each time dimension at each level corresponds to multiple independent storage files; and a sending module configured to, upon expiration of a second timed message stored in a storage file corresponding to a target time dimension, send the second timed message to a second storage file corresponding to a next-level time dimension, in descending order of time dimensions, wherein the target time dimension is any one of the time dimensions at each level. According to a sixth aspect of an embodiment of the present disclosure, a computing device is provided, comprising: a memory and a processor; the memory is configured to store computer-executable instructions; the processor is configured to execute the computer-executable instructions, wherein the computer-executable instructions, when executed by the processor, implement the steps of the message processing method described above. According to a seventh aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided, storing computer-executable instructions, wherein the instructions, when executed by the processor, implement the steps of the message processing method described above. According to an eighth aspect of an embodiment of the present disclosure, a computer program product is provided, including a computer program / instruction, which implements the steps of the above-mentioned message processing method when executed by a processor.One embodiment of the present disclosure implements obtaining a first scheduled message; searching, based on the current delay time of the first scheduled message, a first storage file corresponding to a first time dimension to which the current delay time belongs, where multiple independent storage files are provided for each level of the time dimension, and the current delay time refers to the delayed processing time of the first scheduled message relative to the current time point; and writing the first scheduled message to the first storage file. By searching, based on the current delay time of the first scheduled message, the first storage file corresponding to the first time dimension to which the current delay time belongs, storage files can be searched based on the time dimension hierarchy, thereby implementing storage of scheduled messages according to the time dimension. By providing multiple independent storage files for each level of the time dimension, time can be divided according to the time dimension hierarchy, achieving hierarchical nested storage of messages rather than linear storage, thereby expanding the time range within which scheduled messages can be stored. By writing the first scheduled message to the first storage file, scheduled messages can be read sequentially based on the storage files, thereby improving the efficiency of scheduled message delivery. BRIEF DESCRIPTION OF THE DRAWINGS Figure 1 is a schematic diagram of the open source RocketMQ scheduled message solution; Figure 2 is a schematic diagram of a solution that relies on RocksDB for scheduled message access; Figure 3 is an architectural diagram of a cloud platform provided in accordance with an embodiment of the present disclosure; Figure 4 is a flow chart of a message processing method provided in accordance with an embodiment of the present disclosure; Figure 5 is a flow chart of a message processing method provided in accordance with an embodiment of the present disclosure; Figure 6 is a schematic diagram of the storage structure of a multi-level time wheel in a message processing method provided in accordance with an embodiment of the present disclosure; Figure 7 is a schematic diagram of a time wheel in a message processing method provided in accordance with an embodiment of the present disclosure; Figure 8 is a schematic diagram of scheduled message distribution in a message processing method provided in accordance with an embodiment of the present disclosure; Figure 9 is a schematic diagram of the scheduled message access process in a message processing method provided in accordance with an embodiment of the present disclosure; Figure 10 is a schematic diagram of the structure of a message processing device provided in accordance with an embodiment of the present disclosure; Figure 11 is a schematic diagram of the structure of a message processing device provided in accordance with an embodiment of the present disclosure; Figure 12 is a block diagram of the structure of a computing device provided in accordance with an embodiment of the present disclosure. The following description of the specific implementation sets forth many specific details to facilitate a full understanding of the present disclosure. However, the present disclosure can be implemented in many other ways than those described herein, and those skilled in the art may make similar generalizations without departing from the scope of the present disclosure. Therefore, the present disclosure is not limited to the specific implementations disclosed below. The terminology used in one or more embodiments of the present disclosure is for the purpose of describing specific embodiments only and is not intended to limit the one or more embodiments of the present disclosure.As used in one or more embodiments of the present disclosure and the appended claims, the singular forms "a," "an," "the," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and / or" used in one or more embodiments of the present disclosure refers to and encompasses any and all possible combinations of one or more of the associated listed items. It should be understood that while the terms "first," "second," and so on may be employed in one or more embodiments of the present disclosure to describe various information, such information should not be limited to these terms. These terms are merely used to distinguish information of the same type from one another. For example, the first could be referred to as the second, and similarly, the second could be referred to as the first, without departing from the scope of one or more embodiments of the present disclosure. Depending on the context, the term "if," as used herein, could be interpreted as meaning "when," "when," or "in response to determining." Furthermore, it should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, storage, and display) involved in one or more embodiments of this disclosure are all authorized by the user or fully authorized by all parties. The collection, use, and processing of these data must comply with the relevant laws, regulations, and standards of the relevant countries and regions, and corresponding access points are provided for users to choose to authorize or deny. First, let's explain the terms used in one or more embodiments of this disclosure. A timed message is a message automatically sent within a specified timeframe. A time wheel is a timer divided into multiple slots, each representing a unit of the wheel, used to record the passage of time. Time wheel rotation refers to the rotation of the wheel, and the backward movement of a slot on the wheel represents the passage of time.
[0002] Slot file: A file used to store scheduled messages. Its logical meaning is a "slot" in the timer, containing the message's send time and content. Recursion: A computer programming technique that solves problems by calling itself. Commitlog file: A data storage file, stored on disk, that contains the actual message data, not index information. The current internet environment has a significant demand for scheduled messaging applications. Scheduled messages are delivered by the server to consumers at a fixed time based on the message's set timer. Due to the delivery characteristics of scheduled messages, the content of scheduled messages is currently often stored in commitlog files on disk or in databases, accessed via random reads using message indexes. However, current storage methods have a very limited time range for storing scheduled messages, resulting in severe write amplification issues and low message read efficiency, which can easily lead to delayed delivery of scheduled messages and page cache pollution. The following describes current storage and access solutions for scheduled messages, with reference to Figures 1 and 2. Figure 1 shows a schematic diagram of an open-source RocketMQ scheduled messaging solution. Figure 2 shows a schematic diagram of a solution that relies on RocksDB for timed message storage and access. Referring to Figure 1, the current open-source RocketMQ timed message solution uses the local file system as a reliable storage medium for delayed messages and a single-level time wheel for relaying timed messages. Delayed message index information is stored separately in the TimerLog file. Timed messages are located and accessed through the single-level time wheel. For long-duration timed messages, message rotation is used to avoid excessive message storage. If a single-level time wheel stores a timed message with a delay of 3 days, a timed message with a current delay of 31 days would need to be rotated 10 times within the single-level time wheel, resulting in a serious write amplification problem. In this implementation, the single-level time wheel is stored in memory, and each slot only stores the message's TimerLog index. Timed messages are written sequentially to the commitLog and TimerLog based on their arrival time, resulting in a fast write speed. However, reads are random. As shown in Figure 1, the timerLog file must be accessed based on the slot address and the commitLog file must be read extensively and randomly based on the timerLog index. Such a reading process is not only slow, but also easily pollutes the page cache.Referring to Figure 2, the current solution that relies on RocksDB for timed message storage and access requires an additional Producer Proxy to determine whether a message is a timed message upon receiving it. If so, the message is sent to RocksDB via a separate storage path for sorted storage. After storage is complete, the RocksDB database content is scanned, and any expired data is sent back to the RocketMQ cluster as a regular message. During the sorting and storage of timed messages in RocksDB, a key is generated for each time point, resulting in significant delays in subsequent reading and retrieval of data and page cache contamination. Based on this, one embodiment of the present disclosure implements obtaining a first timed message; based on the current delay time of the first timed message, searching for a first storage file corresponding to the first time dimension to which the current delay time belongs. Multiple independent storage files are configured for each time dimension at each level; the current delay time refers to the delayed processing time of the first timed message relative to the current time point; and writing the first timed message to the first storage file. By searching the first storage file corresponding to the first time dimension to which the current delay time belongs based on the current delay time of the first scheduled message, the storage file can be searched based on the time dimension hierarchy, enabling storage of scheduled messages according to the time dimension. By setting up multiple independent storage files corresponding to each time dimension hierarchy, time can be divided according to the time dimension hierarchy, achieving hierarchical nested storage of messages rather than linear storage, thus expanding the time range in which scheduled messages can be stored. By writing the first scheduled message to the first storage file, scheduled messages can be read sequentially based on the storage file, thereby improving scheduled message delivery efficiency and avoiding page cache pollution caused by random reads. This disclosure provides a message processing method, a cloud platform, a message processing apparatus, a computing device, a computer-readable storage medium, and a computer program product, each of which is described in detail in the following embodiments. See Figure 3, which shows an architecture diagram of a cloud platform provided by one embodiment of the disclosure. The cloud platform 300 includes a control terminal 302 and a storage space 304. The storage space 304 is configured with multiple independent storage files corresponding to different levels of time dimensions. The control terminal 302 is configured to obtain a first scheduled message; search, based on the current delay time of the first scheduled message, for a first storage file corresponding to the first time dimension to which the current delay time belongs. The current delay time refers to the delayed processing time of the first scheduled message relative to the current time point; and write the first scheduled message to the first storage file.In practical applications, storage space can include disks and memory, as well as storage objects such as databases capable of storing data. Specifically, storage space can be divided into space for storing storage files and space for storing commit logs. Each storage file can be independently stored in a slot on each level of the time wheel. Storage files can be stored in a multi-level time wheel storage structure. A connection can be established between the control terminal 302 and the storage space 304 via a network. The network provides a medium for the communication link between the control terminal 302 and the storage space 304. Networks can include various connection types, such as wired or wireless communication links or fiber optic cables. Data transmitted by the control terminal 302 may need to undergo encoding, transcoding, compression, and other processing before being sent to the storage space 304. By setting up multiple independent storage files corresponding to different levels of time dimensions in the storage space 304, the sequential writing and storage of timed messages can be achieved according to the different levels of time dimensions. This expands the upper limit of the storage duration of timed messages and increases the number and duration of timed messages that can be stored. The control terminal 302 obtains a first scheduled message; based on the current delay time of the first scheduled message, searches for a first storage file corresponding to the first time dimension to which the current delay time belongs in ascending order of time dimension levels; and writes the first scheduled message to the first storage file. This can improve storage efficiency and accuracy of scheduled messages. Furthermore, in an optional embodiment of the present disclosure, the multiple storage files corresponding to each time dimension level in the storage space 304 include multiple working storage files and reserved storage files. The control terminal 302 is further configured to monitor the scheduled messages stored in the storage files corresponding to each hierarchical time dimension. When a second scheduled message stored in the storage file corresponding to the target hierarchical time dimension expires, the control terminal 302 determines, based on the current delay time of the second scheduled message, a second reserved storage file corresponding to the next hierarchical time dimension in descending order of the time dimension hierarchies, and sends the second scheduled message to the second reserved storage file. The target hierarchical time dimension is any one of the hierarchical time dimensions. When the current delay time of the second scheduled message matches the current storage time range of the next hierarchical time dimension, the control terminal 302 stores the second scheduled message in the second working storage file corresponding to the second reserved storage file. In an optional embodiment of the present disclosure, the control terminal 302 obtains a first scheduled message; based on the current delay time of the first scheduled message, searches for a first storage file corresponding to the first time dimension to which the current delay time belongs; and writes the first scheduled message to the first storage file in the storage space 304.Storage space 304 includes a multi-level time wheel for storing timed messages and a message submission log. The multi-level time wheel is structured based on the hierarchy of the time dimension. Each level of the time wheel corresponds to a level of the time dimension. Each level of the time wheel includes multiple independent storage files (i.e., slot files) for storing timed messages within the corresponding time range. When the control terminal 302 obtains a first timed message, it recursively searches upward from the lowest level of the time wheel in ascending order of the time dimension hierarchy until it finds the time wheel of the time dimension level corresponding to the current delay time. The first timed message is then stored in the storage file of that time wheel. For example, if each level of the time wheel contains 60 storage files, the first-level time wheel is a second-level wheel (can store a delay time range of 0-59 seconds, and each storage file can store a timed message within 1 second), the second-level time wheel is a graded wheel (can store a delay time range of 0-59 minutes, and each storage file can store a timed message within 1 minute), and the third-level time wheel is an hour-level wheel (can store a delay time range of 0-59 hours, and each storage file can store a timed message within 1 hour), and assuming that the current delay time of a first timed message is 1 minute and 6 seconds, the first timed message can be stored in the second storage file in the second-level time wheel. The control terminal 302 monitors the timed messages stored in the multiple levels of the time wheel. When a timed message expires or is about to expire, the control terminal 302 sends the timed message from the currently stored time wheel to the next-level time wheel in descending order of the time dimension. If the currently stored time wheel is the lowest-level time wheel, the third scheduled message that expires in the lowest-level time wheel is sent to the submission log and stored as a normal message. By setting multiple working storage files and multiple reserved storage files corresponding to each time dimension in storage space 304, this embodiment of the present disclosure supports preemptive message distribution. This avoids the problem of delayed scheduled message delivery caused by an excessive number of scheduled messages being unable to be promptly delivered to storage files corresponding to lower-level time dimensions. It also avoids the problem of message overwriting caused by prematurely triggering forwarding tasks. Furthermore, in an optional embodiment of the present disclosure, storage space 304 also includes a submission log. The control terminal 302 is further configured to write the third scheduled message to the submission log when the third scheduled message stored in the storage file corresponding to the lowest-level time dimension expires.By applying an embodiment of the present disclosure, when a third scheduled message stored in a storage file corresponding to the lowest-level time dimension expires, the third scheduled message is written to the commit log. This allows the expired scheduled message to be resent to the commit log for storage, thereby completing the management of the entire lifecycle of the scheduled message. Referring to Figure 4, a flow chart of a message processing method provided according to an embodiment of the present disclosure is shown, specifically including the following steps. Step 402: Obtain a first scheduled message. In actual applications, the first scheduled message can be obtained and then written to enable subsequent delivery of the written first scheduled message based on the passage of time. Specifically, the first scheduled message can be understood as a newly generated scheduled / delayed message that has not yet been delivered, or as a scheduled / delayed message that has not yet expired. The first scheduled message carries a corresponding scheduled delivery time or a current delay time. The scheduled delivery time can be used to indicate the specific time at which the first scheduled message is to be delivered, and the current delay time can be understood as the delay required for delivery of the first scheduled message. For example, if the current time is 14:00:00, and the message type of the first scheduled message is a scheduled message, the corresponding scheduled delivery time carried may be 14:10:00. If the message type of the first scheduled message is a delayed message, the corresponding current delay time carried may be 10 minutes. It should be noted that although the scheduled delivery time and the current delay time differ in semantic concepts, they both reflect that in practical applications, the message requires delayed delivery, unlike ordinary messages that are delivered immediately. Therefore, for ease of explanation, in this disclosure, scheduled messages and delayed messages are collectively referred to as scheduled messages, and the scheduled delivery time and the current delay time are collectively referred to as the current delay time. In actual implementation, each new first scheduled message is generated, and a corresponding current delay time is generated for the first scheduled message. The current delay time can be used to subsequently store and retrieve the first scheduled message. Furthermore, the current delay time corresponding to the first scheduled message can be determined based on the specific circumstances of the actual application scenario. For example, in an online shopping scenario, an online order can be closed if it's not paid within 45 minutes. The current delay time for the first scheduled message can then be set to 45 minutes. In a memo reminder scenario, a reminder message can be sent 30 days after a pending item is processed. The current delay time for the first scheduled message can then be set to 30 days.In an optional embodiment of the present disclosure, upon the generation of a first scheduled message, the first scheduled message can be directly retrieved and written and delivered according to the corresponding current delay time. In practical applications, newly generated messages may include scheduled messages and regular messages. After each message is generated, the message content can be first written to disk for storage, and then delivered separately for scheduled messages and regular messages based on message type. Since scheduled messages cannot be delivered immediately and often require storage for a period of time before being delivered, if a large number of scheduled messages are generated suddenly within a period of time, the accumulation of scheduled messages can easily lead to insufficient storage space, excessive server scheduling pressure, and other issues, resulting in lost or delayed delivery of scheduled messages. Based on this, in an optional embodiment of the present disclosure, retrieving the first scheduled message can include the following steps: receiving a scheduled message to be stored; writing the scheduled message to be stored into a submission log; scanning each scheduled message recorded in the submission log, and extracting the unexpired first scheduled message from the submission log according to a sequential write rule based on the current delay time of each scheduled message. Specifically, scheduled messages to be stored can be understood as newly generated scheduled messages that have not yet been written to disk. A commit log can be a commitlog file on disk or a database in a storage engine, a storage object capable of storing message content. The sequential write rule can be understood as a rule that writes scheduled messages in chronological order. In actual applications, newly generated scheduled messages and regular messages from each server can be sent to the message processing system in the cloud platform. Upon receiving these scheduled messages to be stored, the message processing system can write them to disk. In other words, it receives the scheduled messages to be stored and writes them to the commit log. Optionally, according to a specific embodiment of the present disclosure, after writing the scheduled message to be stored into the commit log, the following steps may be performed: scanning the scheduled messages recorded in the commit log, having an enqueue thread extract each scheduled message and place it into a queue; if the scheduled message is extracted from the queue and has not expired, writing the scheduled message into a storage file; if the scheduled message is extracted from the queue and has expired, returning the scheduled message to the commit log and updating its message type to a normal message. Optionally, according to another specific embodiment of the present disclosure, after writing the scheduled message to be stored into the commit log, the following steps may be performed: scanning the scheduled messages recorded in the commit log, extracting the first scheduled message that has not expired from the commit log based on the current delay time of each scheduled message and in accordance with a sequential writing rule.Furthermore, unexpired first scheduled messages can be written to a storage file, thereby enabling delivery of the first scheduled messages based on reading the expired scheduled messages from the storage file. In practical applications, to achieve sequential reading and writing of scheduled messages, during the extraction of unexpired first scheduled messages from the commit log, the first scheduled messages can be extracted according to a sequential writing rule based on the current delay time of each scheduled message recorded in the commit log. This allows the first scheduled messages to be sorted according to the chronological order of message delivery, enabling sequential reading and writing of the first scheduled messages, which is beneficial for improving the processing efficiency of scheduled messages. Furthermore, according to a specific embodiment of the present disclosure, extracting unexpired first scheduled messages from the commit log based on the current delay time of each scheduled message and the sequential writing rule may include: determining an extraction order based on the current delay time of each scheduled message and the sequential writing rule; and extracting the unexpired first scheduled messages from the commit log according to the extraction order. According to another specific embodiment of the present disclosure, extracting unexpired first scheduled messages from a submission log based on the current delay time of each scheduled message and in accordance with a sequential write rule may include: extracting the unexpired first scheduled messages from the submission log, and sorting the extracted first scheduled messages in chronological order based on the current delay time of each scheduled message and in accordance with the sequential write rule. Through this embodiment of the present disclosure, receiving scheduled messages to be stored; writing the scheduled messages to be stored to the submission log enables the scheduled messages to be stored to be written to a disk; scanning each scheduled message recorded in the submission log, extracting the unexpired first scheduled messages from the submission log based on the current delay time of each scheduled message and in accordance with the sequential write rule, thereby extracting the first scheduled messages in chronological order, and sequentially writing the first scheduled messages to a storage file. This enables subsequent sequential access to the scheduled messages in the storage file, thereby improving the efficiency of reading and writing scheduled messages. Step 404: Based on the current delay time of the first scheduled message, search for a first storage file corresponding to the first time dimension to which the current delay time belongs. Multiple independent storage files are configured for each time dimension at each level. The current delay time refers to the delayed processing time of the first scheduled message relative to the current time point. In an optional embodiment of the present disclosure, when a first scheduled message is obtained, an index can be assigned to the message content of each first scheduled message according to the corresponding current delay time. The index can be stored in a one-dimensional format in memory, and the message content corresponding to the index can be stored on disk or in a database.Based on the index, the message content can be read from a disk or database according to the expiration time of each first scheduled message to complete message delivery. Specifically, a one-dimensional format may include data storage formats such as an array, a queue, and a linked list. In another optional embodiment of the present disclosure, upon obtaining a first scheduled message, the first storage file corresponding to the first time dimension to which the current delay time belongs can be searched based on the current delay time of the first scheduled message. Specifically, the time dimension level can include seconds, minutes, hours, days, years, and so on, and can be set according to actual needs. The lower the level of the time dimension, the higher the time accuracy. For example, a second-level storage file stores scheduled messages accurate to within one second (e.g., scheduled messages between 8:00:00 and 8:00:01), while a day-level storage file stores all scheduled messages within a day (e.g., scheduled messages between 8:00:00 yesterday and 7:59:59 today). In practical applications, based on the current delay time of the first scheduled message, the first time dimension to which the current delay time belongs can be searched in each level of time dimensions. Furthermore, the first time dimension to which the current delay time belongs can be searched in ascending order of the time dimension levels. For example, the ascending order of the time dimension levels can be understood as first seconds, then minutes, then hours, and so on. Specifically, the first time dimension can be understood as the time dimension to which the current delay time belongs. The first storage file can be understood as a storage file included in the first time dimension, which is used to store the first scheduled message. The multiple storage files included in any time dimension can be stored in a storage format such as an array, a linked list, or a queue. In one or more embodiments of the present disclosure, each different time dimension can include multiple different storage files, and each different time dimension can include the same number of storage files. The multiple storage files included in each different time dimension can be stored in the form of a time wheel, with each grid of the time wheel corresponding to a storage file.For example, assuming that the time dimension includes four different levels: seconds, minutes, hours, and days, the second-level time dimension may include 60 different storage files, each for storing scheduled messages within one second; the minute-level time dimension may include 60 different storage files, each for storing scheduled messages within one minute; the hour-level time dimension may include 60 different storage files, each for storing scheduled messages within one hour; and the day-level time dimension may include 60 different storage files, each for storing scheduled messages within one day. Using these 240 storage files at these four different levels, it is possible to store scheduled messages for 150 days, or nearly half a year. It should be noted that the above is merely an example of an optional multi-level storage method. The number of storage files that can be stored in each time dimension, as well as the time range that each storage file corresponds to, can be determined based on actual needs and are not limited in this disclosure. Preferably, the number of storage files at the lowest level can be set as large as possible. This can maximize the time range that can be stored in the multi-level storage files, thereby avoiding the problem of write amplification caused by the need to rewrite the scheduled message to the storage files in the short term. Optionally, in one embodiment of the present disclosure, based on the current delay time of the first scheduled message, the first time dimension to which the current delay time belongs can be searched in ascending order of the time dimension levels, and the first scheduled message can then be stored in any first storage file included in the first time dimension. Furthermore, when reading scheduled messages from the storage files of the first time dimension, the scheduled messages in the first storage files can be retrieved by traversing each first storage file. Optionally, in another embodiment of the present disclosure, based on the current delay time of the first scheduled message, searching for the first storage file corresponding to the first time dimension to which the current delay time belongs can include the following steps: determining the first time dimension to which the current delay time belongs based on the current delay time of the first scheduled message and the current storage time ranges of the time dimensions at each level; and searching for the first storage file in multiple storage files corresponding to the first time dimension. Specifically, the current storage time ranges of the time dimensions at each level are different.For example, assuming that each hierarchical time dimension includes 60 storage files, and the storage time range of each storage file corresponding to the second-level time dimension is 1 second, the storage time range of each storage file corresponding to the minute-level time dimension is 1 minute, the storage time range of each storage file corresponding to the hour-level time dimension is 1 hour, and the storage time range of each storage file corresponding to the day-level time dimension is 2.5 days, then the current storage time range of the second-level time dimension is 1 minute; the current storage time range of the minute-level time dimension is 1 hour; the current storage time range of the hour-level time dimension is 60 hours (i.e., 2.5 days); and the current storage time range of the day-level time dimension is 150 days. Optionally, the first time dimension to which the current delay time belongs can be determined based on the current delay time of the first scheduled message and the current storage time ranges of the time dimensions at each hierarchical level, in ascending order of the time dimension hierarchies. In actual implementation, the search can begin with the current storage time range corresponding to the lowest-level time dimension. If the current delay time is within the current storage time range, the lowest-level time dimension is determined as the first time dimension to which the current delay time belongs. If it is not within the current storage time range, the search continues toward the next-level time dimension until the first time dimension corresponding to the current storage time range that includes the current delay time is found. Optionally, the search for the first storage file among multiple storage files corresponding to the first time dimension can be performed by determining any one of the multiple storage files corresponding to the first time dimension as the first storage file. Alternatively, the first storage file can be determined in chronological order based on the storage time ranges corresponding to the respective storage files. In the embodiments of the present disclosure, the first time dimension to which the current delay time belongs is determined based on the current delay time of the first scheduled message and the current storage time range of each level of the time dimension, in ascending order of the time dimension hierarchy. The first storage file is searched for in multiple storage files corresponding to the first time dimension. This allows for a recursive search from bottom to top based on the time dimension hierarchy to find the first storage file corresponding to the first scheduled message, thereby improving the accuracy and efficiency of first scheduled message storage. Furthermore, by setting up multi-level storage files based on the time dimension hierarchy, the storage duration of scheduled messages can be exponentially extended, increasing the storage capacity of scheduled messages. Furthermore, the write amplification factor (WAM) is reduced from 0(n) to WAM(logn), effectively alleviating the write amplification problem.Optionally, in one embodiment of the present disclosure, determining the first time dimension to which the current delay time belongs based on the current delay time of the first scheduled message and the current storage time ranges of time dimensions at each level, in ascending order of the time dimension hierarchy, may include the following steps: In ascending order of the time dimension hierarchy, identifying whether the current delay time of the first scheduled message falls within the current storage time range of the time dimension at the current level, until a first time dimension whose current storage time range includes the current delay time is found. In actual applications, after obtaining the first scheduled message and its current delay time, a search may be performed starting from the current storage time range of the lowest-level time dimension, in ascending order of the time dimension hierarchy. If the current delay time does not fall within the current storage time range of the lowest-level time dimension, the search may continue within the current storage time range of the next-level time dimension, and the search may be recursively performed upward until the first time dimension to which the current delay time belongs is found. For example, assuming that the current storage time range corresponding to the lowest-level time dimension (seconds) is 0:00:00-0:00:59, and the current delay time of the first scheduled message is 1 minute and 32 seconds, a comparison with the current storage time range corresponding to the seconds level indicates that the current delay time does not belong to the seconds time dimension. Continuing to search the time dimension one level above the seconds level (minutes), since the current storage time range corresponding to the minutes level is 0:00-0:59, it is determined that the current delay time belongs to the minutes time dimension. Therefore, the minutes time dimension is determined as the first time dimension. By applying an embodiment of the present disclosure, determining the first time dimension to which the current delay time belongs through a bottom-up recursive search can improve search efficiency for the first time dimension. Optionally, in one embodiment of the present disclosure, searching for the first storage file in multiple storage files corresponding to the first time dimension may include the following steps: sequentially writing rules in the multiple storage files corresponding to the first time dimension to search for the first storage file. Specifically, the sequential writing rule can be understood as a rule for sequentially writing scheduled messages in chronological order. It can also be understood as a rule for sequentially writing first scheduled messages into a storage file based on the chronological order of their current delay times. In actual applications, after determining the first time dimension, the sequential writing rule can be used to search for a first storage file to which the first scheduled message can be written based on the order of the current time ranges among multiple storage files corresponding to the first time dimension.For example, assuming the current storage time range corresponding to the second level is 0:00:00-0:00:59, the current storage time range corresponding to the minute level is 0:00-0:59, and the current delay time of the first scheduled message is 1 minute and 32 seconds, the time ranges corresponding to the storage files corresponding to the first time dimension should be: 0:00-0:01, 0:01-0:02, and 0:58-0:59 (a total of 60 storage files, each storing a scheduled message within 1 minute). Based on the sequential writing rule, it can be determined that the time range corresponding to 1 minute and 32 seconds should be 0:01-0:02. The storage file corresponding to this time range is then determined as the first storage file corresponding to the first scheduled message. By applying the embodiments of the present disclosure, by searching for the first storage file according to a sequential writing rule in multiple storage files corresponding to the first time dimension, the first scheduled file can be written sequentially into the corresponding storage file in chronological order. This supports sequential reading of scheduled messages during message delivery, improves message delivery efficiency, and avoids delivery delays. Step 406: Write the first scheduled message to the first storage file. In an optional embodiment of the present disclosure, the message content of the first scheduled message can be written directly to the first storage file. In another optional embodiment of the present disclosure, index information of the first scheduled message can be written to the first storage file, and the message content can be stored on disk or in a database. The index information indicates the specific storage location of the message content in the disk file or database. Optionally, the storage structure of the first storage file can be any data structure. To support sequential reading of scheduled messages during delivery upon expiration, in an optional embodiment of the present disclosure, the storage file can include a file log. Writing the first scheduled message to the first storage file can include the following steps: Writing the first scheduled message to the file log of the first storage file. Specifically, a file log is a storage structure that only supports writing data from the tail and reading data from the head. Writing the first scheduled message to the file log of the first storage file involves directly writing the message content of the first scheduled message to the file log of the first storage file. By applying the embodiments of the present disclosure, writing the first scheduled message to the file log of the first storage file enables sequential writing and reading of the first scheduled messages, thereby improving the efficiency of processing scheduled messages. In practical applications, when scheduled messages in multi-level storage files expire, it is still necessary to deliver the expired scheduled messages.In an optional embodiment of the present disclosure, the following S4002-S4004 may also be included:.
[0003] S4002: Monitoring the timed messages stored in the storage files corresponding to the time dimensions at each level. Optionally, monitoring the timed messages stored in the storage files corresponding to the time dimensions at each level may include monitoring the timed messages in each storage file corresponding to the time dimensions at each level.
[0004] S4004: When the second scheduled message stored in the storage file corresponding to the target-level time dimension expires, the second scheduled message is sent to the second storage file corresponding to the next-level time dimension in descending order of the time dimension levels. The target-level time dimension is any one of the time dimensions at each level. Specifically, the second scheduled message can be understood as the scheduled message stored in the storage file corresponding to the target-level time dimension. The second storage file can be understood as the storage file corresponding to the next-level time dimension. Specifically, the expiration of the second scheduled message can be understood as the current time reaching or approaching the current delay time of the second scheduled message. For example, assuming the current delay time of the second scheduled message is "8:01:32," the second scheduled message is determined to have expired when the current time reaches "8:01:32" or is approaching "8:01:32," and the second scheduled message is sent down to the corresponding second-level storage file. By applying the embodiments of the present disclosure, it is possible to monitor the timed messages stored in the storage files corresponding to the time dimensions of each level. When the second timed message stored in the storage file corresponding to the time dimension of the target level expires, the second timed message is sent to the second storage file corresponding to the time dimension of the next level in descending order of the time dimension levels. This allows the timed messages to be sent from the high-level storage file to the low-level storage file, and dynamically manages the timed messages based on the rolling of the time wheel over time. In an optional embodiment of the present disclosure, the multiple storage files corresponding to the time dimension of each level include multiple working storage files and reserved storage files; sending the second scheduled message to the second storage file storage corresponding to the time dimension of the next level in descending order of the levels of the time dimension may include the following steps: based on the current delay time of the second scheduled message, determining the second reserved storage file corresponding to the time dimension of the next level in descending order of the levels of the time dimension, and sending the second scheduled message to the second reserved storage file storage; when the current delay time of the second scheduled message matches the current storage time range of the time dimension of the next level, storing the second scheduled message from the second reserved storage file to the second working storage file corresponding to the time dimension of the next level.In actual applications, to prevent the possibility of delayed delivery of scheduled messages from a higher level to a lower level due to an excessive number of pending scheduled messages, multiple working storage files and multiple reserved storage files can be configured for each time dimension at each level. The working storage files are used for writing and reading scheduled messages within the corresponding time range, while the reserved storage files are used to pre-store scheduled messages in the storage files at the previous level that are about to expire. Specifically, if a second scheduled message stored in a storage file at the target level is about to expire, the second scheduled message can be first stored in the second reserved storage file corresponding to the time dimension at the next level. When the second scheduled message expires, the second scheduled message can be transferred from the second reserved storage file to the second working storage file corresponding to the time dimension at the next level. The number of reserved storage files can be determined based on actual application requirements. The time dimension corresponding to the reserved storage files is the same as that corresponding to the working storage files. Exemplarily, each different level of time dimension may correspond to 60 working storage files and 60 reserved storage files. If the time range of the scheduled message stored in the second-level working storage file is 0:00:00-0:00:59, the time range of the scheduled message stored in the second-level reserved storage file may be 0:01:00-0:01:59. Specifically, the second reserved storage file can be understood as the reserved storage file corresponding to the time dimension of the next level below the current level time dimension. Optionally, based on the current delay time of the second scheduled message, in descending order of the time dimension levels, determining the second reserved storage file corresponding to the next level time dimension, and sending the second scheduled message to the second reserved storage file for storage may include: when the forwarding task is triggered in advance, based on the current delay time of the second scheduled message, in descending order of the time dimension levels, determining the second reserved storage file corresponding to the next level time dimension, and sending the second scheduled message to the second reserved storage file for storage. Specifically, the forwarding task can be understood as a task of sending the second timed message from the storage file at the current level to the storage file at the next level when the second timed message expires. Specifically, the current storage time range can be understood as the storage time range corresponding to the working storage file.For example, when the current time is 0:01:00, all messages within the period of 0:00:00-0:00:59 have been delivered, and the current storage time range corresponding to the second-level working storage file is updated to 0:01:00-0:01:59. At this time, the current delay time of the second scheduled message matches the current storage time range of the next-level time dimension, and the second scheduled message can be stored from the second reserved storage file to the second working storage file corresponding to the next-level time dimension. By applying the embodiments of the present disclosure, based on the current delay time of the second scheduled message, the second reserved storage file corresponding to the next-level time dimension is determined in descending order of the levels of the time dimension, and the second scheduled message is sent to the second reserved storage file for storage; when the current delay time of the second scheduled message matches the current storage time range of the next-level time dimension, the second scheduled message is stored in the second working storage file corresponding to the second reserved storage file. This allows the second scheduled message that is about to expire in the storage file of the current level to be sent downward to the reserved storage file of the next level in advance. Therefore, when the second scheduled message expires for delivery, the scheduled message can be directly obtained from the reserved storage file corresponding to the time dimension of the same level, thereby improving message acquisition efficiency and avoiding delayed message delivery. Optionally, when the second scheduled message stored in the storage file corresponding to the target-level time dimension expires, before sending the second scheduled message to the second storage file corresponding to the next-level time dimension in descending order of the time dimension, the following steps may be further included: identifying the time difference between the current time and the current delay time of the second scheduled message; and determining that the second scheduled message has expired if the time difference is less than a preset threshold. Specifically, the time difference can be understood as the length of time difference between the current time and the current delay time of the second scheduled message. For example, if the current time is 8:00:00 and the current delay time of the second scheduled message is "8:00:20," the time difference between the current time and the current delay time of the second scheduled message is 20 seconds. In actual applications, the advance forwarding time of scheduled messages in storage files corresponding to time dimensions at different levels may differ, that is, the preset thresholds may differ.For example, for storage files corresponding to the minute-level time dimension, the preset threshold may be 10 seconds. That is, if the time difference is 10 seconds, the expiring scheduled messages in the minute-level storage file are sent to the second-level reserved storage file. For storage files corresponding to the hourly time dimension, the preset threshold may be 10 minutes. That is, if the time difference is 10 minutes, the expiring scheduled messages in the hourly storage file are sent to the minute-level reserved storage file. It should be noted that the preset thresholds corresponding to storage files at different levels of time dimensions can be set based on actual needs and are not limited in this disclosure. In the embodiments of the present disclosure, by identifying the time difference between the current time and the current delay time of a second scheduled message, and determining that the second scheduled message has expired when the time difference is less than a preset threshold, the task trigger condition for the forwarding task corresponding to the lead time can be set based on the preset threshold. This can thereby trigger the forwarding of expiring scheduled messages in the storage file at the current level of time dimension in advance, further improving the efficiency of reading scheduled messages and avoiding delays in the delivery of scheduled messages. Optionally, when the current level time dimension is the lowest level time dimension, the following step may also be included: when a third scheduled message stored in the storage file corresponding to the lowest level time dimension expires, writing the third scheduled message to a commit log. Specifically, the third scheduled message can be understood as a scheduled message stored in the storage file corresponding to the lowest level time dimension, that is, a scheduled message stored in a second-level storage file. The commit log can be understood as a commitlog file on disk. In actual applications, when the third scheduled message stored in the storage file corresponding to the lowest level time dimension expires, the third scheduled message will be delivered from the multi-level storage files and will not be rewritten to the storage file. Instead, it will be sent to the commitlog file for storage. After being delivered from the storage file corresponding to the lowest level time dimension and written to the commit log, the third scheduled message can be subsequently processed as a normal message. By applying the embodiments of the present disclosure, when the third scheduled message stored in the storage file corresponding to the lowest level time dimension expires, the third scheduled message can be resent to the commitlog file for storage, thereby completing the management of the entire lifecycle of the scheduled message.One embodiment of the present disclosure implements obtaining a first scheduled message; searching, based on the current delay time of the first scheduled message, for a first storage file corresponding to the first time dimension to which the current delay time belongs in ascending order of the time dimension hierarchy, where multiple independent storage files are provided for each time dimension hierarchy; and writing the first scheduled message to the first storage file. Applying this embodiment of the present disclosure, by searching, based on the current delay time of the first scheduled message, for a first storage file corresponding to the first time dimension to which the current delay time belongs in ascending order of the time dimension hierarchy, it is possible to store scheduled messages according to time dimensions, expanding the time range in which scheduled messages can be stored. Writing the first scheduled message to the first storage file enables sequential reading of scheduled messages based on the storage file, thereby improving the efficiency of scheduled message delivery. Referring to Figure 5, a flowchart of a message processing method according to one embodiment of the present disclosure is shown, specifically including the following steps: Step 502: Monitoring scheduled messages stored in storage files corresponding to time dimensions at each hierarchy level, where multiple independent storage files are provided for each time dimension hierarchy. Step 504: When the second scheduled message for the storage file storage corresponding to the target-level time dimension expires, the second scheduled message is sent to the second storage file storage corresponding to the next-level time dimension in descending order of the time dimension levels. The target-level time dimension is any one of the time dimensions at each level. It should be noted that the specific implementation of steps 502-504 is the same as that of steps S4002-S4004 described above and will not be further described in this disclosure. Using embodiments of the present disclosure, scheduled messages for storage file storage corresponding to each level of time dimension can be monitored. When the second scheduled message for the storage file storage corresponding to the current level of time dimension expires, the second scheduled message is sent to the second storage file storage corresponding to the next-level time dimension in descending order of the time dimension levels. This allows scheduled messages to be sent from higher-level storage files to lower-level storage files, enabling dynamic management of scheduled messages over time. The following, in conjunction with Figures 6-9, further illustrates the message processing method provided by the present disclosure, using its application in a multi-level time wheel-based scheduled message scrolling / access solution as an example. Figure 6 illustrates a schematic diagram of the storage structure of a multi-level time wheel in a message processing method provided by one embodiment of the present disclosure.Figure 7 shows a schematic diagram of a time wheel in a message processing method according to an embodiment of the present disclosure. Figure 8 shows a schematic diagram of scheduled message distribution according to a message processing method according to an embodiment of the present disclosure. Figure 9 shows a schematic diagram of the scheduled message access process according to a message processing method according to an embodiment of the present disclosure. Referring to Figure 6, the scheduled message scrolling / access solution based on a multi-level time wheel primarily replaces a single-level time wheel with a multi-level time wheel to address the storage and access issues of scheduled messages. By replacing a single-level time wheel with a multi-level time wheel based on different time dimensions, and by changing the storage structure corresponding to each slot in each level of the time wheel to a grid storage structure (SlotLog), the storage files corresponding to each SlotLog are independent, supporting sequential writing and reading. Each level of the time wheel has different precision. In practical applications, the first-level (second-level) time wheel can be stored in memory, while the remaining higher-level time wheels can be stored on disk. Except for the second-level time wheel, each independent slot file in the other levels of the time wheel can directly store the message content corresponding to the scheduled message, without the need for additional indexing. Each slot in the second-level wheel can be configured with an independent slot file for directly writing scheduled message content or storing the message index of a scheduled message, which can then be read from the commitlog file using the message index. Figure 6 uses the example of a timer wheel consisting of timerWheel Level 1, then timerWheel Level 2, and finally timerWheel Level 3. TimerWheel Level 1 is the lowest-level time wheel, corresponding to the second-level time wheel. Each slot in this wheel can store scheduled messages within one second. TimerWheel Level 2 is the minute-level time wheel. Each slot in this wheel can store scheduled messages within one minute. TimerWheel Level 3 is the hour-level time wheel. Each slot in this wheel can store scheduled messages within one hour. Each time wheel can include the same number of grids, that is, it can include the same number of independent slot files (Slot1, Slot2, Slot3, Slot4). The multi-level time wheel designed according to the above structure can exponentially expand the storage duration of scheduled messages as the time dimension level increases, breaking the fixed-length storage duration limit, supporting scheduled messages with arbitrary delays, and avoiding the linear increase of storage space size, thereby saving a large amount of storage space.Furthermore, because scheduled messages in the upper-level time wheel are sent downward one level at a time, the write amplification factor (WAM) can be reduced from 0(n) to (logn), effectively alleviating the severe write amplification problem inherent in single-level time wheels. In practical applications, the number of slot files in each time wheel layer can be configured according to actual needs. The number of slot files in the first-level time wheel can be maximized to avoid write amplification caused by short-term scheduled messages being written to subsequent time wheels and repeatedly distributed downward. When an unexpired scheduled message is obtained, the current delay time of the scheduled message can be used to recursively search the upper level, starting from timerWheel Level 1, for the time wheel layer corresponding to the current delay time. Once the corresponding time wheel layer is found, the slot in the time wheel at the corresponding level can be determined based on the time sequence, allowing the scheduled messages to be written sequentially to the corresponding slot files in the time wheel at the corresponding level. When a message in a time wheel expires, messages in higher-level time wheels can be forwarded downward. When a scheduled message in a second-level time wheel expires, the message can be delivered from the second-level time wheel and written to a commit log file for storage. When a scheduled message expires and is delivered from the second-level time wheel, the lifecycle of the scheduled message ends. See Figure 7 , which illustrates the specific storage structure design for each level of time wheels. Taking the example of 60 storage slots in each level of time wheel, each level of time wheel can include a 60-slot write window and an additional 60-slot reserved window to provide lead time for message delivery. It should be noted that the number of reserved windows can be determined based on actual needs and is not limited in this disclosure. Referring to Figure 8 , the following, combined with Figure 8 , further explains why a reserved window is required for the scheduled message scrolling / access solution based on multi-level time wheels. For example, if the bottom-level time wheel has an accuracy of 1s (second wheel), the second-level accuracy is 1min (grading wheel), and the third-level accuracy is 1min (hour wheel), then from 19:59:00 to 19:59:59, the second wheel can operate normally and consume messages in its own cell. At 20:00:00, the second wheel needs to obtain the messages it needs from the grading wheel. However, the grading wheel only stores messages from 19:00 to 19:59, so the messages for 20:00 need to be obtained from the hour wheel. Therefore, at 20:00:00, the bottom-level second wheel triggers the simultaneous rotation of the two upper-level time wheels.Within this second, messages from the two upper levels clearly cannot reach the grid corresponding to 20:00:00 in the lowest level in a timely manner. To avoid delays in scheduled message delivery, a forwarding advance is set. This triggers the forwarding task in advance, ensuring that each time wheel begins forwarding before reaching the round boundary, sending expiring scheduled messages to the next-level time wheel. In this case, if the total grid number of a time wheel is not redundant, the premature forwarding task will inevitably overwrite data in the grid of the next-level time wheel, resulting in the serious consequence of scheduled message loss. Therefore, a reserved window is set for each level of time wheel. At 19:59:50 seconds, the data in the 20:00 grid of the grading wheel is distributed to the reserved window corresponding to 20:00:00-20:00:59 in the second-level wheel. The data for 20:00 in the grading wheel is pre-fetched from the hour-level wheel at 19:50 and stored in the reserved window corresponding to 20:00-20:59 in the grading wheel. This prevents delayed delivery and loss of scheduled messages, significantly improving the efficiency of reading and delivering scheduled messages. Referring to Figure 9, the following, combined with Figure 9, further explains the access logic of scheduled messages in the multi-level timer-based message rotation / access solution. When a message enters the system, it is typically first written to disk, that is, stored in the commitlog. After entering the commitlog, it can be scanned for scheduled messages, and the enqueue thread (TimerEnqueueGetService) retrieves the message from the enqueue. Messages in this queue are divided into two types: Unexpired scheduled messages are written to the dashed box on the left side of Figure 9 and rotated as scheduled messages. The other type of message is one that has already expired when it is retrieved from the enqueue queue. These messages are directly placed back into the commitlog file. The dashed boxes on the left side of Figure 9 include timerwheel Level 1 and timerwheel Level 2, representing multi-level time wheels of varying precision. As the higher-level time wheel (Level 2) rotates, it dumps messages in expired slots onto the next-level time wheel (Level 1), writing the message contents directly into their corresponding slots. As each slot in a lower-level time wheel expires, the timed message in that slot is directly removed from the time wheel and written to the commitlog file. Once in the commitlog, the message becomes a regular message that can be consumed. This concludes the lifecycle of the timed message.In the embodiments of the present disclosure, a timed message rolling / access scheme based on a multi-level time wheel is employed. When an unexpired timed message is acquired, the system recursively searches for the corresponding time wheel from the lowest level, starting from the lowest level, from the bottom up, based on the current delay time corresponding to the timed message. The timed message is then sequentially written into the corresponding slot of the time wheel at that level. This ensures accurate writing of the timed message, improving timed message writing efficiency. By pre-triggering the timed message forwarding task, expiring messages in the current level time wheel are forwarded to the reserved slot of the next level time wheel before the message in the time wheel expires. This supports delivery lead time, avoids message delivery delays and message loss, and further improves the processing efficiency and accuracy of timed messages. Corresponding to the above-mentioned method embodiments, the present disclosure also provides a message processing device embodiment. Figure 10 shows a schematic structural diagram of a message processing device provided by one embodiment of the present disclosure. As shown in Figure 10, the device includes: an acquisition module 1002 configured to acquire a first timed message. The search module 1004 is configured to search for a first storage file corresponding to the first time dimension to which the current delay time of the first scheduled message belongs, based on the current delay time of the first scheduled message. Multiple independent storage files are provided for each time dimension at each level. The current delay time refers to the delayed processing time of the first scheduled message relative to the current time point. The write module 1006 is configured to write the first scheduled message into the first storage file. Optionally, the search module 1004 is further configured to: determine the first time dimension to which the current delay time belongs based on the current delay time of the first scheduled message and the current storage time ranges of the time dimensions at each level; and search for the first storage file in the multiple storage files corresponding to the first time dimension. Optionally, the search module 1004 is further configured to: determine, in ascending order of time dimension levels, whether the current delay time of the first scheduled message is within the current storage time range of the time dimension at the current level; if so, determine that the time dimension at the current level is the first time dimension to which the current delay time belongs. Optionally, the search module 1004 is further configured to: search for the first storage file in the plurality of storage files corresponding to the first time dimension according to the sequentially written rule.Optionally, the message processing device further includes a sending module configured to: monitor scheduled messages stored in storage files corresponding to time dimensions at each level; and, when a second scheduled message stored in a storage file corresponding to a target-level time dimension expires, send the second scheduled message to a second storage file corresponding to a next-level time dimension in descending order of time dimension levels, where the target-level time dimension is any one of the time dimensions at each level. Optionally, the multiple storage files corresponding to each level of time dimension include multiple working storage files and reserved storage files; and the sending module is further configured to: determine, based on a current delay time of the second scheduled message, a second reserved storage file corresponding to the next-level time dimension in descending order of time dimension levels, and send the second scheduled message to the second reserved storage file; and, when the current delay time of the second scheduled message matches a current storage time range of the next-level time dimension, store the second scheduled message from the second reserved storage file to the second working storage file corresponding to the next-level time dimension. Optionally, the sending module is further configured to: identify the time difference between the current time and the current delay time of the second scheduled message; and if the time difference is less than a preset threshold, determine that the second scheduled message has expired. Optionally, if the current level time dimension is the lowest level time dimension, the sending module is further configured to: write the third scheduled message to the submission log when the third scheduled message stored in the storage file corresponding to the lowest level time dimension has expired. Optionally, the acquisition module 1002 is further configured to: receive a scheduled message to be stored; write the scheduled message to be stored to the submission log; scan each scheduled message recorded in the submission log, and extract the unexpired first scheduled message from the submission log according to a sequential writing rule based on the current delay time of each scheduled message. Optionally, the storage file includes a file log; and the writing module 1006 is further configured to: write the first scheduled message to the file log of the first storage file. In the embodiments of the present disclosure, by searching for the first storage file corresponding to the first time dimension to which the current delay time belongs based on the current delay time of the first scheduled message, in ascending order of the time dimension hierarchy, the storage file can be searched based on the time dimension hierarchy, thereby storing scheduled messages according to the time dimension and expanding the time range in which scheduled messages can be stored. By writing the first scheduled message to the first storage file, scheduled messages can be read sequentially based on the storage file, thereby improving the efficiency of scheduled message delivery. The above is an exemplary embodiment of a message processing device according to this embodiment.It should be noted that the technical solution of this message processing device and the technical solution of the aforementioned message processing method share the same concept. For details not described in detail in the technical solution of the message processing device, please refer to the description of the technical solution of the aforementioned message processing method. Corresponding to the aforementioned method embodiment, the present disclosure also provides a message processing device embodiment. Figure 11 shows a schematic structural diagram of a message processing device provided by one embodiment of the present disclosure. As shown in Figure 11, the device includes: a monitoring module 1102 configured to monitor timed messages stored in storage files corresponding to time dimensions at each level, where each time dimension at each level corresponds to multiple independent storage files. A sending module 1104 configured to, upon expiration of a second timed message stored in a storage file corresponding to a target time dimension, send the second timed message to the second storage file corresponding to the next time dimension at the next level, in descending order of time dimensions, where the target time dimension is any one of the time dimensions at each level. By applying embodiments of the present disclosure, it is possible to monitor the scheduled messages stored in storage files corresponding to each level of time dimensions. When the second scheduled message stored in the storage file corresponding to the current level of time dimensions expires, the second scheduled message is sent to the second storage file corresponding to the next level of time dimensions, in descending order of time dimensions. This allows scheduled messages to be sent from higher-level storage files to lower-level storage files, enabling dynamic management of scheduled messages over time. The above is a schematic diagram of a message processing device according to this embodiment. It should be noted that the technical solution of this message processing device and the technical solution of the message processing method described above share the same concept. Details not described in detail in the technical solution of the message processing device can be found in the description of the technical solution of the message processing method described above. Figure 12 shows a block diagram of a computing device 1200 provided according to one embodiment of the present disclosure. Components of computing device 1200 include, but are not limited to, a memory 1210 and a processor 1220. Processor 1220 and memory 1210 are connected via a bus 1230. Database 1250 is used to store data. The computing device 1200 also includes an access device 1240 that enables the computing device 1200 to communicate via one or more networks 1260.Examples of these networks include a public switched telephone network (PSTN), a local area network (LAN), a wide area network (WAN), a personal area network (PAN), or a combination of communication networks such as the Internet. Access device 1240 may include one or more of any type of wired or wireless network interface (e.g., a network interface controller (NIC)), such as an IEEE 802.11 wireless local area network (WLAN) wireless interface, a Worldwide Interoperability for Microwave Access (Wi-MAX) interface, an Ethernet interface, a universal serial bus (USB) interface, a cellular network interface, a Bluetooth interface, or a near field communication (NFC) interface. In one embodiment of the present disclosure, the above-mentioned components of computing device 1200 and other components not shown in FIG. 12 may also be connected to each other, for example, via a bus. It should be understood that the computing device block diagram shown in FIG12 is for illustrative purposes only and does not limit the scope of this disclosure. Those skilled in the art may add or replace other components as needed. Computing device 1200 may be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., a tablet computer, personal digital assistant, laptop computer, notebook computer, netbook, etc.), a mobile phone (e.g., a smartphone), a wearable computing device (e.g., a smartwatch, smart glasses, etc.), or other types of mobile devices, or a stationary computing device such as a desktop computer or personal computer (PC). Computing device 1200 may also be a mobile or stationary server. Processor 1220 is configured to execute the following computer-executable instructions, which, when executed by the processor, implement the steps of the message processing method described above. The above is a schematic diagram of a computing device according to this embodiment.It should be noted that the technical solution of this computing device and the technical solution of the message processing method described above are based on the same concept. Any details not described in detail in the technical solution of the computing device can be found in the description of the technical solution of the message processing method described above. An embodiment of the present disclosure also provides a computer-readable storage medium storing computer-executable instructions. When executed by a processor, these computer-executable instructions implement the steps of the message processing method described above. The above is a schematic diagram of a computer-readable storage medium according to this embodiment. It should be noted that the technical solution of this storage medium and the technical solution of the message processing method described above are based on the same concept. Any details not described in detail in the technical solution of the storage medium can be found in the description of the technical solution of the message processing method described above. An embodiment of the present disclosure also provides a computer program product comprising a computer program / instructions. When executed by a processor, these computer program / instructions implement the steps of the message processing method described above. The above is a schematic diagram of a computer program product according to this embodiment. It should be noted that the technical solution of this computer program product and the technical solution of the message processing method described above are based on the same concept. Any details not described in detail in the technical solution of the computer program product can be found in the description of the technical solution of the message processing method described above. Specific embodiments of the present disclosure have been described above. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. Furthermore, the processes depicted in the figures do not necessarily require the specific order or sequential order shown to achieve the desired results. In certain embodiments, multitasking and parallel processing are also possible or may be advantageous. The computer instructions include computer program code, which may be in source code form, object code form, executable files, or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard drive, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signals, telecommunication signals, and software distribution media. It should be noted that the content of the computer-readable medium may be appropriately increased or decreased based on the requirements of patent practice. For example, in some regions, according to patent practice, computer-readable media does not include electric carrier signals and telecommunication signals.It should be noted that, for ease of description, the aforementioned method embodiments are described as a series of actions. However, those skilled in the art should understand that the embodiments of the present disclosure are not limited to the order of the actions described, as certain steps may be performed in a different order or simultaneously, depending on the embodiments of the present disclosure. Furthermore, those skilled in the art should also understand that the embodiments described in this specification are preferred embodiments, and the actions and modules described are not necessarily required for the embodiments of the present disclosure. In the above embodiments, the description of each embodiment has its own emphasis. For portions not described in detail in a particular embodiment, reference should be made to the relevant descriptions of other embodiments. The preferred embodiments disclosed above are merely intended to help illustrate the present disclosure. The optional embodiments do not describe all details in detail, nor do they limit the present disclosure to the specific implementation methods described. Obviously, many modifications and variations are possible based on the content of the embodiments of the present disclosure. The present disclosure selects and describes these embodiments in detail to better explain the principles and practical applications of the embodiments of the present disclosure, thereby enabling those skilled in the art to better understand and utilize the present disclosure. The present disclosure is limited only by the claims and their full scope and equivalents.
Claims
Claims 1. A message processing method, comprising: Obtaining a first timing message; According to the current delay time of the first scheduled message, searching for a first storage file corresponding to a first time dimension to which the current delay time belongs, where multiple independent storage files are provided for each level of time dimension, and the current delay time refers to a delayed processing time of the first scheduled message relative to the current time point; and writing the first scheduled message to the first storage file.
2. The method according to claim 1, wherein searching, based on the current delay time of the first timing message, for a first storage file corresponding to a first time dimension to which the current delay time belongs comprises: Determining, based on the current delay time of the first timing message and the current storage time range of each level of time dimension, the first time dimension to which the current delay time belongs; Search for a first storage file in the plurality of storage files corresponding to the first time dimension.
3. The method according to claim 2, wherein determining the first time dimension to which the current delay time belongs based on the current delay time of the first timing message and the current storage time range of each level time dimension includes: identifying whether the current delay time of the first timing message is within the current storage time range of the current level time dimension in order of the levels of the time dimension from low to high; if so, determining that the current level time dimension is the first time dimension to which the current delay time belongs.
4. The method according to claim 2 or 3, wherein searching for the first storage file in the plurality of storage files corresponding to the first time dimension comprises: In the multiple storage files corresponding to the first time dimension, the rules are written in order to search for the first storage file.
5. The method according to any one of claims 1 to 4, further comprising: Monitor the timed messages stored in storage files corresponding to the time dimension of each level; When the second timed message of the storage file storage corresponding to the target level time dimension expires, the second timed message is sent to the second storage file storage corresponding to the next level time dimension in descending order of the levels of the time dimension, where the target level time dimension is any one of the time dimensions of each level.
6. The method according to claim 5, wherein the plurality of storage files corresponding to each level of the time dimension include a plurality of working storage files and a reserved storage file; and wherein the sending the second timed message to the second storage file storage corresponding to the next level of the time dimension in descending order of the time dimension levels comprises: Based on the current delay time of the second scheduled message, determine the second reserved storage file corresponding to the next-level time dimension in descending order of the time dimension levels, and send the second scheduled message to the second reserved storage file for storage; if the current delay time of the second scheduled message matches the current storage time range of the next-level time dimension, store the second scheduled message from the second reserved storage file to the second working storage file corresponding to the next-level time dimension.
7. The method according to claim 5 or 6, wherein the storage file corresponding to the time dimension at the target level When the stored second timed message expires, before the second timed message is sent to the second storage file corresponding to the next level time dimension in descending order of the time dimension, the method further includes: identifying a time difference between a current time and a current delay time of the second timing message; When the time difference is smaller than a preset threshold, it is determined that the second timing message is expired.
8. The method according to any one of claims 1 to 7, wherein when the current level time dimension is the lowest level time dimension, the method further comprises: When the third timing message stored in the storage file corresponding to the lowest level time dimension expires, the third timing message is written into the submission log.
9. The method according to any one of claims 1 to 8, wherein obtaining the first timing message comprises: receiving a timed message to be stored; Writing the timed message to be stored into a submission log; Scan each timed message recorded in the submission log, write rules in order based on current delay times of each timed message, and extract a first timed message that has not expired from the submission log.
10. The method according to any one of claims 1 to 9, wherein the storage file comprises a file log; and the writing the first timing message into the first storage file comprises: The first timing message is written into the file log of the first storage file.
11. A message processing method, comprising: Monitoring the timed messages stored in the storage files corresponding to the time dimensions of each level, wherein each level of the time dimension is corresponding to multiple independent storage files; when a second timed message stored in the storage file corresponding to the time dimension of a target level expires, sending the second timed message to the second storage file storage corresponding to the time dimension of the next level in descending order of the levels of the time dimension, wherein the target level time dimension is any one of the time dimensions of each level.
12. A cloud platform comprising a control terminal and a storage space, wherein the storage space is provided with multiple independent storage files corresponding to time dimensions at different levels; the control terminal is configured to obtain a first timing message; and based on a current delay time of the first timing message, search for a first storage file corresponding to a first time dimension to which the current delay time belongs, wherein: The current delay time refers to the delayed processing time of the first timing message relative to the current time point; the first timing message is written into the first storage file.
13. The cloud platform according to claim 12, wherein the multiple storage files corresponding to the time dimension of each level in the storage space include multiple working storage files and reserved storage files; the control end is further used to monitor the timed messages stored in the storage files corresponding to the time dimensions of each level; when the second timed message stored in the storage file corresponding to the time dimension of the current level expires, based on the current delay time of the second timed message, the second reserved storage file corresponding to the time dimension of the next level is determined in descending order of the levels of the time dimension, and the second timed message is sent to the second reserved storage file for storage; when the current delay time of the second timed message matches the current storage time range of the time dimension of the next level, the second timed message is stored from the second reserved storage file to the second working storage file corresponding to the time dimension of the next level.
14. The cloud platform according to claim 12 or 13, wherein the storage space further comprises a submission log; the control terminal is further configured to store a third timed message corresponding to the storage file stored in the lowest layer time dimension. In the case of a third timing message, the third timing message is written into the submission log.
15. A computing device comprising: memory and processor; The memory is used to store computer programs / instructions, and the processor is used to execute the computer programs / instructions. When the computer programs / instructions are executed by the processor, the steps of the message processing method according to any one of claims 1 to 11 are implemented.
16. A computer-readable storage medium storing a computer program / instruction, wherein the computer program / instruction, when executed by a processor, implements the steps of the message processing method according to any one of claims 1 to 11.
17. A computer program product, comprising a computer program / instruction, wherein when the computer program / instruction is executed by a processor, the steps of the message processing method according to any one of claims 1 to 11 are implemented.
Citation Information
Patent Citations
Message processing method and device, electronic equipment and storage medium
CN113709214A
Timed task scheduling method and device, computer equipment and storage medium
CN114168281A
Timing message sending method and system for customizing time, terminal and storage medium
CN115242744A
Timing task processing method and device, computer equipment and readable storage medium
CN116795516A
Cited By
Delay message processing method based on message queue, medium, equipment and product
CN121349733A