Event message processing method and device, electronic equipment and storage medium

By using the time round algorithm in event message processing, the massive delayed tasks are accurately executed, which solves the problems of inaccurate task execution and great impact on IO performance in the prior art, and achieves efficient and accurate task processing.

CN119987969APending Publication Date: 2025-05-13BEIJING QIYI CENTURY SCI & TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202510093855.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-21
Publication Date
2025-05-13

AI Technical Summary

Technical Problem

The prior art is difficult to accurately perform massive delayed tasks, resulting in large impacts on IO performance or inaccurate task execution time.

Method used

By obtaining event messages, determining event processing strategies and delay parameters, building delay tasks, and adding them to the corresponding slots of the time round algorithm to achieve delay task triggering with second-level accuracy.

Benefits of technology

Accurate execution of delayed tasks is achieved, processing efficiency is improved, and the reliability and accuracy of tasks are ensured.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119987969A_ABST
    Figure CN119987969A_ABST
Patent Text Reader

Abstract

The invention provides an event message processing method and device, electronic equipment and a storage medium. The method comprises the steps that an event message is acquired, and the event message is generated when a user performs corresponding operation on a platform to trigger a target event; determining an event processing strategy and a delay parameter corresponding to the target event according to the event message; constructing a delay task according to the event processing strategy and the delay parameter; the delay task is added to a corresponding slot position of a time round algorithm, so that execution of the delay task is triggered when the current time reaches a time point corresponding to the slot position, and the time point corresponding to the slot position is a starting time point corresponding to the delay task. According to the method, the delay task with second-level precision is triggered through the time wheel algorithm, so that accurate execution of the delay task can be ensured, and the processing efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to an event message processing method, device, electronic device and storage medium. Background Art

[0002] As some business scenarios of the open platform require delayed processing of some business event messages, for example, checking whether payment has been made half an hour after receiving the order event message, checking whether the invitation code has been used 3 days after receiving the event message, etc. With the increase in business volume and users, the number of delayed event messages will also be large. The current processing method is to add a scheduled scanning function to the event task corresponding to each event message to detect whether it needs to be executed. For the specific execution time of the delayed task, if the detection interval is short, the IO performance will be greatly affected. If the detection interval is long, the task cannot be executed according to the actual execution time of the delayed task. As the number of event messages increases, the number of corresponding tasks continues to increase. The accurate execution of massive delayed tasks has become an urgent problem to be solved. Summary of the invention

[0003] The purpose of the embodiments of the present application is to provide an event message processing method, device, electronic device and storage medium to solve the problem that delayed tasks corresponding to events cannot be accurately executed. The specific technical solution is as follows:

[0004] In a first aspect, the present application provides an event message processing method, comprising:

[0005] Obtaining an event message, wherein the event message is generated when a user performs a corresponding operation on the platform to trigger a target event;

[0006] Determine, according to the event message, an event processing strategy and a delay parameter corresponding to the target event;

[0007] Constructing a delay task according to the event processing strategy and the delay parameters;

[0008] The delayed task is added to the corresponding slot of the timing wheel algorithm to trigger the execution of the delayed task when the current time reaches the time point corresponding to the slot, wherein the time point corresponding to the slot is the start time point corresponding to the delayed task.

[0009] In a possible implementation, determining, according to the event message, an event processing strategy and a delay parameter corresponding to the target event includes:

[0010] Parsing the event message to obtain the event type corresponding to the target event;

[0011] The event processing strategy and delay parameters corresponding to the event type are obtained in the preset configuration file.

[0012] In a possible implementation manner, before obtaining the event processing strategy and delay parameter corresponding to the event type in the preset configuration file, the method further includes:

[0013] Parsing the event message to obtain event attribute information corresponding to the target event;

[0014] Determining whether the target event meets the filtering condition corresponding to the event type according to the event attribute information;

[0015] In the case where the event attribute information meets the filtering condition corresponding to the event type, the step of obtaining the event processing strategy and delay parameters corresponding to the event type in the preset configuration file is performed.

[0016] In a possible implementation manner, after adding the delayed task to the corresponding slot of the time wheel algorithm, the method further includes:

[0017] The delayed task is persistently stored in a database;

[0018] When the service is restarted, obtaining the delayed task from the database;

[0019] Resume and continue to execute the delayed task.

[0020] In a possible implementation, the method further includes:

[0021] After the delayed task is executed, the task status of the delayed task in the database is updated to completed.

[0022] In a possible implementation, the method further includes:

[0023] Obtaining processing data corresponding to each link in the process of processing the event message and the processing result of the event message;

[0024] The processing data and the processing results corresponding to each link are stored in a database.

[0025] In a possible implementation, the method further includes:

[0026] Generate notification information according to the processing result of the event message;

[0027] Obtaining a message receiving mode of a user corresponding to the event message;

[0028] The notification information is sent to the user according to the message receiving mode.

[0029] In a second aspect, the present application provides an event message processing device, including:

[0030] An acquisition module, used to acquire event messages, wherein the event messages are generated when a user performs a corresponding operation on the platform to trigger a target event;

[0031] A determination module, used to determine an event processing strategy and a delay parameter corresponding to the target event according to the event message;

[0032] A construction module, used for constructing a delay task according to the event processing strategy and the delay parameters;

[0033] An adding module is used to add the delayed task to the corresponding slot of the timing wheel algorithm to trigger the execution of the delayed task when the current time reaches the time point corresponding to the slot, wherein the time point corresponding to the slot is the start time point corresponding to the delayed task.

[0034] In a possible implementation manner, the determining module is specifically configured to:

[0035] Parsing the event message to obtain the event type corresponding to the target event;

[0036] The event processing strategy and delay parameters corresponding to the event type are obtained in the preset configuration file.

[0037] In a possible implementation, the device further includes a parsing module, configured to:

[0038] Parsing the event message to obtain event attribute information corresponding to the target event;

[0039] Determining whether the target event meets the filtering condition corresponding to the event type according to the event attribute information;

[0040] In the case where the event attribute information meets the filtering condition corresponding to the event type, the step of obtaining the event processing strategy and delay parameters corresponding to the event type in the preset configuration file is performed.

[0041] In a possible implementation, the device further includes a persistence module, which is used to:

[0042] The delayed task is persistently stored in a database;

[0043] When the service is restarted, obtaining the delayed task from the database;

[0044] Resume and continue to execute the delayed task.

[0045] In a possible implementation manner, the device further includes an updating module, configured to:

[0046] After the delayed task is executed, the task status of the delayed task in the database is updated to completed.

[0047] In a possible implementation manner, the device further includes a storage module, configured to:

[0048] Obtaining processing data corresponding to each link in the process of processing the event message and the processing result of the event message;

[0049] The processing data and the processing results corresponding to each link are stored in a database.

[0050] In a possible implementation manner, the device further includes a sending module, configured to:

[0051] Generate notification information according to the processing result of the event message;

[0052] Obtaining a message receiving mode of a user corresponding to the event message;

[0053] The notification information is sent to the user according to the message receiving mode.

[0054] In a third aspect, an electronic device is provided, comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus;

[0055] Memory, used to store computer programs;

[0056] The processor is used to implement any method step described in the first aspect when executing a program stored in the memory.

[0057] In a fourth aspect, a computer-readable storage medium is provided, characterized in that a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, any method step described in the first aspect is implemented.

[0058] In a fifth aspect, a computer program product comprising instructions is provided, which, when executed on a computer, enables the computer to execute any of the event message processing methods described above.

[0059] Beneficial effects of the embodiments of the present application:

[0060] The embodiment of the present application provides an event message processing method, device, electronic device and storage medium. In the embodiment of the present application, first, an event message is obtained, wherein the event message is generated when a user performs a corresponding operation on the platform to trigger a target event, then, according to the event message, the event processing strategy and delay parameters corresponding to the target event are determined, and a delay task is constructed according to the event processing strategy and the delay parameters, and finally, the delay task is added to the corresponding slot of the time wheel algorithm, so that when the current time reaches the time point corresponding to the slot, the execution of the delay task is triggered, wherein the time point corresponding to the slot is the start time point corresponding to the delay task. The present application implements the triggering of the delay task with second-level accuracy through the time wheel algorithm, thereby ensuring the accurate execution of the delay task and improving processing efficiency.

[0061] Of course, implementing any product or method of the present application does not necessarily require achieving all of the advantages described above at the same time. BRIEF DESCRIPTION OF THE DRAWINGS

[0062] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.

[0063] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0064] One or more embodiments are exemplarily described by pictures in the corresponding drawings, and these exemplified descriptions do not constitute limitations on the embodiments. Elements with the same reference numerals in the drawings represent similar elements, and unless otherwise stated, the figures in the drawings do not constitute proportional limitations.

[0065] Figure 1 A flowchart of an event message processing method provided in an embodiment of the present application;

[0066] Figure 2 A flowchart of another event message processing method provided in an embodiment of the present application;

[0067] Figure 3 A flowchart of another event message processing method provided in an embodiment of the present application;

[0068] Figure 4 An overall processing flow chart of an event message processing method provided in an embodiment of the present application;

[0069] Figure 5A schematic diagram of the structure of an event message processing device provided in an embodiment of the present application;

[0070] Figure 6 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0071] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.

[0072] The disclosure below provides many different embodiments or examples to implement different structures of the present invention. In order to simplify the disclosure of the present invention, the parts and settings of specific examples are described below. Of course, they are only examples, and the purpose is not to limit the present invention. In addition, the present invention can repeat reference numbers and / or letters in different examples. This repetition is for the purpose of simplification and clarity, and does not itself indicate the relationship between the various embodiments and / or settings discussed.

[0073] Figure 1 A flow chart of an event message processing method provided for an embodiment of the present application. This method can be applied to one or more electronic devices such as smart phones, laptops, desktop computers, portable computers, servers, etc. In addition, the execution subject of this method can be hardware or software. When the above-mentioned execution subject is hardware, the execution subject can be one or more of the above-mentioned electronic devices. For example, a single electronic device can execute this method, or multiple electronic devices can cooperate with each other to execute this method. When the above-mentioned execution subject is software, this method can be implemented as multiple software or software modules, or it can be implemented as a single software or software module. It is not specifically limited here.

[0074] like Figure 1 As shown, the method specifically includes:

[0075] Step 101: Obtain an event message, wherein the event message is generated when a user performs a corresponding operation on the platform to trigger a target event.

[0076] The above-mentioned target events refer to the behavioral events of users on the platform. For example, in large video platforms, the membership system processes various user behavior events (such as order payment, completion of movie viewing tasks, welfare collection, etc.).

[0077] The above event message refers to the event message generated accordingly when the target event occurs.

[0078] In actual applications, when users perform operations on the platform (such as order payment, movie viewing task completion, welfare collection, daily check-in), the client or server generates corresponding event messages and sends these event messages to the message receiving module through the message queue system (such as RocketMQ).

[0079] Based on this, in an embodiment of the present application, an event message is received from a message queue through a message receiving module (such as a MessageReceiver class), and after the event message arrives, the event message is pushed to an interface or component (such as a MessageListener) in the message queue for receiving and processing messages for processing.

[0080] Step 102: Determine an event processing strategy and delay parameters corresponding to the target event according to the event message.

[0081] Event handling strategy refers to the way to handle target events.

[0082] Delay parameter refers to the time parameter that the target event needs to be delayed for processing. In the application, the delay parameters corresponding to different types of events can be set by the user according to actual needs.

[0083] In an embodiment of the present application, the specific implementation of determining the event processing strategy and delay parameters corresponding to the target event based on the event message may include the following steps: parsing the event message to obtain the event type corresponding to the target event; obtaining the event processing strategy and delay parameters corresponding to the event type in a preset configuration file.

[0084] Event type refers to the type of behavior content corresponding to the target event.

[0085] In the above configuration files, corresponding event processing strategies and delay parameters are configured for different event types.

[0086] With this solution, users can flexibly adjust event processing strategies and delay parameters corresponding to different types of events through configuration files, so that the system can quickly adapt to business changes.

[0087] In addition, you can also configure filtering conditions for different types of events in the configuration file. In applications, message forwarding, filtering, and judgment logic are generally defined through YAML or JSON configuration files.

[0088] Based on this, in another embodiment of the present application, before obtaining the event processing strategy and delay parameter corresponding to the event type in the preset configuration file, the following steps may also be included:

[0089] Parse the event message to obtain event attribute information corresponding to the target event; determine whether the target event meets the filtering conditions corresponding to the event type based on the event attribute information; if the event attribute information meets the filtering conditions corresponding to the event type, execute the step of obtaining the event processing strategy and delay parameters corresponding to the event type in a preset configuration file.

[0090] The above event attribute information may include the user ID, order ID and other relevant data corresponding to the target event.

[0091] Through this solution, the filtering conditions corresponding to different types of events can be flexibly set through the configuration file, so as to filter out events that do not meet the conditions and reduce unnecessary processing.

[0092] In actual applications, the filtering conditions and event processing strategies corresponding to event types may include the following:

[0093] 1. Order Payment Event: This event is triggered when the user completes the order payment. Corresponding filtering conditions: Check user VIP status: confirm whether the user is a VIP member. If the user is a VIP member, the corresponding processing method is: Open membership: open or extend membership for the user according to the order payment situation; Accumulate member points: accumulate corresponding member points for the user account according to the payment amount or rules.

[0094] 2. Watch Task Complete Event: This event is triggered when the user completes the scheduled watch task. There is no filtering condition, and the corresponding processing method is: Increase the chance of winning a prize: increase the chance of winning a prize for the user based on the completion of the watch task; Notify the user: send a notification to the user to inform him of the reward for completing the task.

[0095] 3. Welfare Collection Event: This event is triggered when a user collects membership benefits. Corresponding filtering conditions: Verify welfare conditions: Check whether the user meets the welfare collection conditions. If the user meets the welfare collection conditions, the corresponding processing method is: Issue corresponding welfare rewards, such as coupons, points, etc. to eligible users; Notify users: Send welfare collection notifications to users to inform them of welfare details.

[0096] 4. User Daily Check-in Event: This event is triggered when the user logs in and signs in every day. There is no filtering condition, and the corresponding processing methods are: Record check-in log: record the user's check-in time and related information; Update consecutive check-in days: update the record of the user's consecutive check-in days; Accumulate check-in rewards: accumulate corresponding check-in rewards, such as points, coupons, etc.; Send check-in success notification: send a successful check-in notification to the user, and reward information.

[0097] Step 103: construct a delay task according to the event processing strategy and the delay parameters.

[0098] Step 104: Add the delayed task to the corresponding slot of the time wheel algorithm to trigger the execution of the delayed task when the current time reaches the time point corresponding to the slot, wherein the time point corresponding to the slot is the start time point corresponding to the delayed task.

[0099] For ease of understanding, step 103 and step 104 are described in a unified manner as follows:

[0100] In the embodiment of the present application, first, a delay task is constructed according to the event processing strategy and delay parameters, and then the delay task is added to the corresponding slot using the time wheel algorithm. When the time wheel turns to the slot, the system triggers and executes the delay task. This solution uses the time wheel algorithm to achieve second-level accurate delay triggering, and supports message merging and splitting, improving processing efficiency and flexibility.

[0101] In addition, in another embodiment of the present application, before constructing the delay task according to the event processing strategy and the delay parameter, the following steps may also be included: when the delay parameter is zero, or the delay parameter corresponding to the event type does not exist in the configuration file, the target event is determined to be an immediate processing event, and the target event is directly processed according to the event processing strategy; when the delay parameter is not zero, the target event is determined to be a delayed processing event, and the step of constructing the delay task according to the event processing strategy and the delay parameter is executed.

[0102] Through the above scheme, for immediate processing events, they can be directly processed according to the corresponding event processing strategy. For delayed processing events, the steps of constructing delayed tasks are executed. In this way, the construction of delayed tasks for unnecessary events can be avoided, saving computing resources.

[0103] In an embodiment of the present application, first, an event message is obtained, wherein the event message is generated when a user performs a corresponding operation on the platform to trigger a target event, then, according to the event message, the event processing strategy and delay parameters corresponding to the target event are determined, and a delay task is constructed according to the event processing strategy and the delay parameters, and finally, the delay task is added to the corresponding slot of the time wheel algorithm, so that when the current time reaches the time point corresponding to the slot, the execution of the delay task is triggered, wherein the time point corresponding to the slot is the start time point corresponding to the delay task. The present application implements the triggering of the delay task with second-level accuracy through the time wheel algorithm, thereby ensuring the accurate execution of the delay task and improving processing efficiency.

[0104] See also Figure 2 , is a flow chart of another embodiment of an event message processing method provided in an embodiment of the present application. Figure 2 As shown, the process may include the following steps:

[0105] Step 201: persistently store the delayed task in a database;

[0106] Step 202: When the service is restarted, obtain the delayed task from the database;

[0107] Step 203: Resume and continue to execute the delayed task.

[0108] For ease of understanding, steps 201 to 203 are described in a unified manner as follows:

[0109] In the embodiment of the present application, a persistence mechanism is introduced to persistently store the delayed task in a database (such as a MySQL database), so that when the service is restarted, the task can be restored from the database and continued to be executed. This solution can solve the memory usage problem and ensure that the task can be restored after the service is restarted.

[0110] In addition, in another embodiment of the present application, the method may further include the following steps: after the delayed task is executed, the task status of the delayed task in the database is updated to completed. In this way, the user can understand the processing status of the delayed task through the task status stored in the database.

[0111] In addition, in another embodiment of the present application, the method may further include the following steps: obtaining the processing data corresponding to each link in the process of processing the event message and the processing result of the event message; storing the processing data corresponding to each link and the processing result in a database. In this way, the system can record all operations (i.e., the processing data and processing results corresponding to each link) in the database to ensure the integrity and traceability of the information.

[0112] See also Figure 3 , is a flow chart of another embodiment of an event message processing method provided in the present application. Figure 3 As shown, the process may include the following steps:

[0113] Step 301: Generate notification information according to the processing result of the event message;

[0114] Step 302: Obtain the message receiving mode of the user corresponding to the event message;

[0115] Step 303: Send the notification information to the user according to the message receiving mode.

[0116] For ease of understanding, steps 301 to 303 are described in a unified manner as follows:

[0117] The above message receiving method can be email, text message or in-site message, etc., which can be set by the user according to actual needs.

[0118] In the embodiment of the present application, after the event message is processed and the processing result is obtained, the notification message generated according to the processing result is sent to the user according to the specified message receiving method, so that the user can understand the progress of the event in real time.

[0119] Optionally, the present application embodiment also provides a processing flow of the event message processing method, such as Figure 4 As shown, the specific steps are as follows.

[0120] 1. User operations generate events: When users pay for orders, watch movies, receive benefits, sign in daily, and perform other operations on the platform, corresponding event messages are generated and sent to the system through the message queue.

[0121] 2. Message reception and filtering: MessageReceiver receives and parses messages, and performs filtering and forwarding according to the configuration file.

[0122] 3. Task scheduling and persistence: For tasks that need to be triggered with a delay, use the time wheel algorithm to schedule them and persist the tasks in the database to ensure reliable execution of the tasks.

[0123] 4. Delayed task triggering: When the time wheel reaches the set time point, the task execution is triggered to complete specific business logic operations, such as opening a membership, accumulating points, notifying users, etc.

[0124] 5. Update records and feedback: The system records all operations in the database to ensure the completeness and traceability of the information.

[0125] To facilitate understanding, the following two specific implementation process examples are provided.

[0126] Example 1: Order payment event.

[0127] 1. User operation generates events: When a user completes order payment on the platform, an order payment event message is generated. The event message is sent to the system's message receiving module through RocketMQ.

[0128] 2. Message parsing and preliminary processing: MessageReceiver receives messages from RocketMQ and calls MessageListener to parse the message content.

[0129] 3. After parsing the message, determine that the event type is order_paid, and read the user ID, order ID, and other related data.

[0130] 4. Configurable forwarding and filtering: According to the configuration file, the system checks whether the user is a VIP. If the user is a VIP, the system further processes the event. The configuration file defines two actions: open membership (open_membership) and accumulate points (bonus_points).

[0131] 5. Task scheduling and storage: The system decides to delay the task for 5 seconds based on the delay parameter set in the configuration file (e.g. 5 seconds). Using the time wheel algorithm, the delayed task is added to the corresponding slot and the task is persistently stored through PersistentTaskManager.

[0132] 6. Delayed triggering and task execution: After 5 seconds, the time wheel turns to the corresponding slot, and the system triggers and executes the task. Execute the logic of opening membership and accumulating points, and update the user's membership status and points information. The system sends a confirmation notification of successful order payment and records the relevant operations in the database.

[0133] Example 2: User daily check-in event.

[0134] 1. User operation generates events: Users log in and sign in every day, generating user sign-in event messages. Event messages are sent to the system's message receiving module through RocketMQ.

[0135] 2. Message parsing and preliminary processing: MessageReceiver receives messages from RocketMQ and calls MessageListener to parse the message content. After parsing the message, it determines that the event type is daily_checkin and reads relevant data such as user ID and check-in time.

[0136] 3. Configurable forwarding and filtering: The system directly processes check-in events according to the configuration file (no filtering conditions are required). The configuration file defines three actions: record check-in logs (log_checkin), update consecutive check-in days (update_streak), and accumulate check-in rewards (reward_points).

[0137] 4. Task scheduling and storage: The daily sign-in task set in the configuration file does not need to be delayed, and the system immediately calls the configured processing action. The system records the user's sign-in time, updates the number of consecutive sign-in days and accumulates sign-in rewards, and all operation results are persisted to the database.

[0138] 5. Instant task execution: The system executes the logic of recording the sign-in log, updating the number of consecutive sign-in days, and accumulating sign-in rewards. A sign-in success notification is sent to the user, informing the reward information, and all operations are recorded in the database.

[0139] In the embodiment of the present application, the system is designed around various message events such as order payment, and realizes flexible processing of multiple types of message events. At the same time, the configuration file defines message forwarding, filtering and simple logical judgment to realize flexible and customized processing rules. In addition, the time wheel algorithm can be used to realize delayed triggering with second-level accuracy, support message merging and splitting, and improve processing efficiency and flexibility.

[0140] Based on the same technical concept, the embodiment of the present application also provides an event message processing device, such as Figure 5 As shown, the device comprises:

[0141] The acquisition module 51 is used to acquire an event message, wherein the event message is generated when a user performs a corresponding operation on the platform to trigger a target event;

[0142] A determination module 52, configured to determine an event processing strategy and a delay parameter corresponding to the target event according to the event message;

[0143] A construction module 53, used to construct a delay task according to the event processing strategy and the delay parameter;

[0144] The adding module 54 is used to add the delayed task to the corresponding slot of the timing wheel algorithm to trigger the execution of the delayed task when the current time reaches the time point corresponding to the slot, wherein the time point corresponding to the slot is the start time point corresponding to the delayed task.

[0145] In a possible implementation manner, the determining module is specifically configured to:

[0146] Parsing the event message to obtain the event type corresponding to the target event;

[0147] The event processing strategy and delay parameters corresponding to the event type are obtained in the preset configuration file.

[0148] In a possible implementation, the device further includes a parsing module, configured to:

[0149] Parsing the event message to obtain event attribute information corresponding to the target event;

[0150] Determining whether the target event meets the filtering condition corresponding to the event type according to the event attribute information;

[0151] In the case where the event attribute information meets the filtering condition corresponding to the event type, the step of obtaining the event processing strategy and delay parameters corresponding to the event type in the preset configuration file is performed.

[0152] In a possible implementation, the device further includes a persistence module, which is used to:

[0153] The delayed task is persistently stored in a database;

[0154] When the service is restarted, obtaining the delayed task from the database;

[0155] Resume and continue to execute the delayed task.

[0156] In a possible implementation manner, the device further includes an updating module, configured to:

[0157] After the delayed task is executed, the task status of the delayed task in the database is updated to completed.

[0158] In a possible implementation manner, the device further includes a storage module, configured to:

[0159] Obtaining processing data corresponding to each link in the process of processing the event message and the processing result of the event message;

[0160] The processing data and the processing results corresponding to each link are stored in a database.

[0161] In a possible implementation manner, the device further includes a sending module, configured to:

[0162] Generate notification information according to the processing result of the event message;

[0163] Obtaining a message receiving mode of a user corresponding to the event message;

[0164] The notification information is sent to the user according to the message receiving mode.

[0165] Based on the same technical concept, the embodiment of the present application also provides an electronic device, such as Figure 6 As shown, it includes a processor 111, a communication interface 112, a memory 113 and a communication bus 114, wherein the processor 111, the communication interface 112, and the memory 113 communicate with each other through the communication bus 114.

[0166] Memory 113, used for storing computer programs;

[0167] The processor 111 is used to execute the program stored in the memory 113 to implement the following steps:

[0168] Obtaining an event message, wherein the event message is generated when a user performs a corresponding operation on the platform to trigger a target event;

[0169] Determine, according to the event message, an event processing strategy and a delay parameter corresponding to the target event;

[0170] Constructing a delay task according to the event processing strategy and the delay parameters;

[0171] The delayed task is added to the corresponding slot of the timing wheel algorithm to trigger the execution of the delayed task when the current time reaches the time point corresponding to the slot, wherein the time point corresponding to the slot is the start time point corresponding to the delayed task.

[0172] The communication bus mentioned in the above electronic device can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.

[0173] The communication interface is used for communication between the above electronic device and other devices.

[0174] The memory may include a random access memory (RAM) or a non-volatile memory (NVM), such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.

[0175] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

[0176] In another embodiment provided by the present application, a computer-readable storage medium is provided, in which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above-mentioned event message processing methods are implemented.

[0177] In another embodiment provided by the present application, a computer program product including instructions is also provided, which, when executed on a computer, enables the computer to execute any event message processing method in the above embodiments.

[0178] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0179] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a general hardware platform, and of course, by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the relevant technology can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0180] It should be understood that the terms used in the text are only for the purpose of describing specific example embodiments, and are not intended to be limiting. Unless the context clearly indicates otherwise, the singular forms "one", "an" and "said" as used in the text may also be meant to include plural forms. The terms "include", "comprise", "contain", and "have" are inclusive, and therefore specify the existence of stated features, steps, operations, elements and / or parts, but do not exclude the existence or addition of one or more other features, steps, operations, elements, parts, and / or combinations thereof. The method steps, processes, and operations described herein are not interpreted as necessarily requiring them to be performed in the specific order described or illustrated, unless the execution order is clearly indicated. It should also be understood that additional or alternative steps may be used.

[0181] The foregoing is merely a specific embodiment of the present invention, which enables those skilled in the art to understand or implement the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features claimed herein.

Claims

1. A method for processing an event message, characterized in that: The method comprises: Obtaining an event message, wherein the event message is generated when a user performs a corresponding operation on the platform to trigger a target event; Determine, according to the event message, an event processing strategy and a delay parameter corresponding to the target event; Constructing a delay task according to the event processing strategy and the delay parameters; The delayed task is added to the corresponding slot of the timing wheel algorithm to trigger the execution of the delayed task when the current time reaches the time point corresponding to the slot, wherein the time point corresponding to the slot is the start time point corresponding to the delayed task.

2. The method according to claim 1, characterized in that Determining, according to the event message, an event processing strategy and a delay parameter corresponding to the target event includes: Parsing the event message to obtain the event type corresponding to the target event; The event processing strategy and delay parameters corresponding to the event type are obtained in the preset configuration file.

3. The method according to claim 2, characterized in that Before obtaining the event processing strategy and delay parameter corresponding to the event type in the preset configuration file, the method further includes: Parsing the event message to obtain event attribute information corresponding to the target event; Determining whether the target event meets the filtering condition corresponding to the event type according to the event attribute information; In the case where the event attribute information meets the filtering condition corresponding to the event type, the step of obtaining the event processing strategy and delay parameters corresponding to the event type in the preset configuration file is performed.

4. The method according to claim 1, characterized in that: After adding the delayed task to the corresponding slot of the time wheel algorithm, the method further includes: The delayed task is persistently stored in a database; When the service is restarted, obtaining the delayed task from the database; Resume and continue to execute the delayed task.

5. The method according to claim 4, characterized in that The method further comprises: After the delayed task is executed, the task status of the delayed task in the database is updated to completed.

6. The method according to claim 1, characterized in that The method further comprises: Obtaining processing data corresponding to each link in the process of processing the event message and the processing result of the event message; The processing data and the processing results corresponding to each link are stored in a database.

7. The method according to claim 1, characterized in that The method further comprises: Generate notification information according to the processing result of the event message; Obtaining a message receiving mode of a user corresponding to the event message; The notification information is sent to the user according to the message receiving mode.

8. An event message processing device, characterized in that: The device comprises: An acquisition module, used to acquire event messages, wherein the event messages are generated when a user performs a corresponding operation on the platform to trigger a target event; A determination module, used to determine an event processing strategy and a delay parameter corresponding to the target event according to the event message; A construction module, used for constructing a delay task according to the event processing strategy and the delay parameters; An adding module is used to add the delayed task to the corresponding slot of the timing wheel algorithm to trigger the execution of the delayed task when the current time reaches the time point corresponding to the slot, wherein the time point corresponding to the slot is the start time point corresponding to the delayed task.

9. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; Memory, used to store computer programs; The processor is used to implement the event message processing method described in any one of claims 1-7 when executing the program stored in the memory.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the event message processing method according to any one of claims 1 to 7 is implemented.

Citation Information

Cited By

  • Virtual item expiration processing method and device, equipment, storage medium and program product

    CN120568140A