An event-driven method and computing device
By isolating event execution and rule judgment logic within computing devices, and utilizing message queues and business object models, the problem of coupling between event-driven logic and source code is solved, improving the flexibility and applicability of business systems and reducing development costs.
Patent Information
- Application Number
- CN202610475590.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-04-10
- Publication Date
- 2026-08-25
AI Technical Summary
In existing technologies, event-driven logic is tightly coupled with the source code, which reduces the flexibility of business systems and makes them unable to adapt to rapidly changing business needs.
By isolating event execution from rule judgment logic and implementing asynchronous operation through message queue configuration, standardized business data can be obtained using a business object model, thus decoupling events and rules and improving flexibility and applicability.
It achieves event-driven flexibility and versatility, reduces computing resource consumption, lowers development costs, and supports diverse business needs and cross-scenario reuse.
Smart Images

Figure CN122633431A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computing device technology, and in particular to an event-driven method and computing device. Background Technology
[0002] As enterprises develop information technology, business processes and event types become increasingly complex, and business systems face complex and ever-changing business requirements. In existing technologies, event-driven logic is hard-coded directly into the source code of the business system. When business requirements change, developers need to modify the source code and retest and redeploy the business system. This approach cannot adapt to rapid changes in business requirements, and the tight coupling between event-driven logic and source code reduces the flexibility of the business system. Summary of the Invention
[0003] This application provides an event-driven method and computing device, which can improve the flexibility of event-driven operations in business systems.
[0004] In a first aspect, embodiments of this application provide an event-driven method, the method comprising: obtaining standardized business data from a business system according to a business object model; wherein the business object model is used to indicate the data fields required to drive a target event; determining the target rule corresponding to the target event from a rule base according to a correspondence relationship; wherein the correspondence relationship is used to indicate the association relationship between the rule and the event; determining whether the business data meets the triggering conditions of the target rule, and writing the target event into a message queue when the conditions are met; obtaining the target event from the message queue and executing the target event on the business system.
[0005] The event-driven method provided in this application embodiment involves a computing device acquiring business data required for a target event from a business system. Based on the correspondence, it determines the target rule corresponding to the target event. Further, based on the business data, it determines whether the business data meets the triggering conditions of the target rule; if so, the corresponding target event is written to a message queue. Finally, the computing device can retrieve the target event from the message queue and execute it. In this method, the rule judgment logic and event execution logic are isolated from each other, and the message queue is configured to ensure that the rule judgment logic and event execution logic can run asynchronously, thereby decoupling events and rules and improving the flexibility of event-driven operations in the business system. In addition, the computing device acquires standardized business data from the business system through a business object model, ensuring that this solution is applicable to different business systems, thereby improving the versatility and applicability of this solution.
[0006] In one possible implementation, determining whether business data meets the triggering condition of the target rule includes: determining the first field and the second field included in the target rule; the first field is used to indicate the basis for judging the triggering condition, and the second field is used to indicate the judgment logic of the triggering condition; obtaining the actual value corresponding to the first field from the business data; determining whether the actual value meets the judgment logic based on the second field; and determining that the business data meets the triggering condition of the target rule if the actual value meets the judgment logic.
[0007] In another possible implementation, the target rule corresponding to the target event is determined from the rule base based on the correspondence. This includes: determining whether the target event is valid based on its metadata; a valid target event means that the target event is in an enabled state and the current time is within the enabled period; if the target event is valid, the target rule corresponding to the target event is determined from the rule base based on the correspondence. These steps provide a specific process for rule judgment, ensuring the feasibility of this solution. Furthermore, by defining the first and second fields, the computing device can quickly locate the judgment basis and judgment logic during rule scanning, reducing additional computing resource consumption and improving the efficiency of rule judgment.
[0008] In another possible implementation, the rule base also includes a third field and a fourth field. The third field indicates other rules that are nested with the target rule, and the fourth field indicates other rules that have logical operation relationships with the target rule. By configuring the third field and the fourth field, multiple rules can be introduced to work together during the rule judgment process, improving the flexibility of event-driven mechanisms and meeting diverse business needs.
[0009] In another possible implementation, the message queue includes index information of the target event. Retrieving the target event from the message queue and executing it on the business system includes: upon detecting a new message in the message queue, retrieving the index information of the target event from the message queue, and retrieving the event interface address and invocation method of the target event from the event database based on the index information; and executing the target event on the business system based on the event interface address and invocation method. It should be understood that by setting up a message queue, the rule judgment process and the event execution process are isolated, eliminating the need for real-time interaction and ensuring they do not interfere with each other. This solves the problem of hard-coding rules and events together in existing technologies, improving the flexibility of event-driven processes.
[0010] In another possible implementation, executing the target event on the business system includes: if the target event is a notification event, determining the notification method and notification object based on the fifth field included in the target event; determining the notification template based on the sixth field included in the target event; filling the notification template with business data to obtain a notification message; and sending the notification message to the notification object according to the notification method to execute the target event on the business system. By providing a specific scheme for executing notification events, the feasibility of this solution is ensured.
[0011] Another possible implementation includes: displaying multiple rules and events via a display device; the display device responding to user actions, associating rules and events to generate configuration information; and receiving the configuration information sent by the display device and establishing corresponding relationships based on the configuration information. This visual configuration eliminates the need for users to write source code. This frees developers from repetitive logic modifications, enabling event-driven systems to be reused across scenarios and reducing costs.
[0012] In another possible implementation, the method further includes: generating a log after executing the target event on the business system; the log includes the following: relevant information about the target rule; relevant information about the target event; and relevant information about the execution result of the target event.
[0013] In another possible implementation, the log recording also includes: change records for the target rule; change records for the target event. Through the above steps, configuring log recording introduces a monitoring and auditing mechanism to the event-driven method, allowing users to promptly understand whether event execution is normal and rule matching is accurate. It also records changes to events or rules, ensuring a certain level of traceability and meeting compliance audit requirements.
[0014] Secondly, this application provides an event-driven device, which includes one or more functional modules for implementing the event-driven method described in the first aspect above.
[0015] Thirdly, embodiments of this application provide a computing device including a processor and a memory; the processor is coupled to the memory; the memory is used to store computer instructions, which are loaded and executed by the processor to enable the computing device to implement the method described in the first aspect.
[0016] Fourthly, embodiments of this application provide a computer-readable storage medium comprising: computer software instructions; when the computer software instructions are executed in a computing device, they cause the computing device to implement the method described in the first aspect.
[0017] Fifthly, embodiments of this application provide a computer program product that, when run on a computing device, causes the computing device to execute the steps of the method related to the first aspect described above, so as to implement the method of the first aspect described above.
[0018] The beneficial effects of the second to fifth aspects mentioned above can be referred to the corresponding description of the first aspect, and will not be repeated here. Attached Figure Description
[0019] Figure 1 This is a schematic diagram of the composition of a computing device provided in an embodiment of this application; Figure 2 This application provides a schematic diagram of the composition of an event-driven center according to an embodiment of the present application. Figure 3 A flowchart illustrating an event-driven method provided in an embodiment of this application; Figure 4 A flowchart illustrating another event-driven method provided in an embodiment of this application; Figure 5 A flowchart illustrating yet another event-driven method provided in an embodiment of this application; Figure 6 A flowchart illustrating yet another event-driven method provided in an embodiment of this application; Figure 7 A flowchart illustrating yet another event-driven method provided in an embodiment of this application; Figure 8 A complete flowchart is provided for an embodiment of this application; Figure 9 This is a schematic diagram of the composition of an event-driven device provided in an embodiment of this application. Detailed Implementation
[0020] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0021] It should be noted that in the embodiments of this application, the words "exemplarily" or "for example" are used to indicate examples, illustrations, or explanations. Any embodiment or design scheme described as "exemplarily" or "for example" in the embodiments of this application should not be construed as being more preferred or advantageous than other embodiments or design schemes. Specifically, the use of the words "exemplarily" or "for example" is intended to present the relevant concepts in a specific manner.
[0022] To facilitate a clear description of the technical solutions of the embodiments of this application, the terms "first" and "second" are used in the embodiments of this application to distinguish the same or similar items with essentially the same function and effect. Those skilled in the art can understand that the terms "first" and "second" are not intended to limit the quantity or execution order.
[0023] The following is a brief explanation of the technical terms used in the embodiments of this application: 1. Event: An event generally refers to an action, change, or state transition that occurs within a system or business process. It is typically used to describe a specific event that happens at a particular point in time, such as a user action, data change, or system notification.
[0024] 2. Rules: Triggering conditions used to influence or determine certain behaviors. Rules include rule factors, which are the basis or weight for rule execution and can be a numerical value, formula, or conditional expression. Rule factors are key parameters used to adjust or control the effect of rule execution.
[0025] 3. Business Objects: Business objects refer to objects in a business system that are used to describe and encapsulate data and behaviors related to the business domain. They usually represent a specific business entity or business process. Business objects focus on the business itself and are an important part of business-oriented modeling.
[0026] 4. Metadata: Metadata refers to data that describes other data. It describes information such as the structure, attributes, source, and purpose of the data, rather than the content of the data itself. The main purpose of metadata is to help understand, manage, and use data, and to improve the discoverability and operability of the data.
[0027] This application provides an event-driven method that separates event execution from rule judgment, reducing their coupling and improving the flexibility of event-driven processes in business systems.
[0028] In some implementations, the computing device obtains the business data required for the target event from the business system. Based on the correspondence, it determines the target rule corresponding to the target event. Further, based on the business data, it determines whether the business data meets the triggering conditions of the target rule; if so, the corresponding target event is written to a message queue. Finally, the computing device can retrieve the target event from the message queue and execute it. In the method of this application embodiment, the rule judgment logic and the event execution logic are isolated from each other, and the rule judgment logic and the event execution logic can run asynchronously by configuring the message queue, thereby decoupling events and rules and improving the flexibility of event-driven operations in the business system. In addition, the computing device obtains standardized business data from the business system through a business object model, ensuring that this solution can be applied to different business systems, thereby improving the versatility and applicability of this solution.
[0029] The embodiments provided in this application will now be described in detail with reference to the accompanying drawings.
[0030] The technical solutions provided in this application can be applied to computing devices, which can be servers with displays or other computing devices. This application does not specifically limit the type of computing device.
[0031] For example, taking a computing device as a server, the server can be a physical or logical server, or it can be two or more physical or logical servers that share different responsibilities and work together to realize the various functions of the server.
[0032] In terms of form factor, the server can be a blade server, a high-density server, a rack server, or a full-rack server; in terms of function, the server can be a general-purpose server, a graphics processing unit (GPU) server, an artificial intelligence (AI) server, etc.
[0033] For example, taking a computing device as a terminal device, the specific form of the terminal device can be an ultra-mobile personal computer (UMPC), tablet computer, laptop computer, netbook, desktop computer, all-in-one computer, etc.
[0034] Figure 1 This is a schematic diagram illustrating the composition of a computing device provided in an embodiment of this application. Figure 1 As shown, the computing device may include a processor 101 and a memory 102; the memory 102 stores instructions executable by the processor 101; when the processor 101 is configured to execute instructions, the computing device executes the event-driven method in the embodiments of this application.
[0035] In some implementations, an event-driven center is deployed in the computing device. The event-driven center is communicatively connected to the business system to obtain business data from the business system and execute the event-driven method of this application embodiment based on the business data. The business system and the event-driven center may be deployed in the same computing device or in different computing devices; this application embodiment does not impose specific limitations on this.
[0036] In some implementations, the computing device is connected to the display device, and the computing device can display multiple rules and multiple events to the user through the display device. The user can configure the correspondence between the rules and the events through the display device.
[0037] Figure 2 This is a schematic diagram illustrating the composition of an event-driven center provided in an embodiment of this application. For example... Figure 2 As shown, the event-driven center 200 includes a configuration module 201, an access module 202, a rule matching engine 203, an event execution module 204, and a log recording module 205.
[0038] The configuration module provides a visual interface, allowing users to configure events, rules, and the correspondence between events and rules, and store the configured events, rules, and correspondence for later use.
[0039] Access module 202 is responsible for establishing communication connections with external business systems and providing a unified standard interface to obtain standardized business data from the business systems.
[0040] The rule matching engine 203 is responsible for periodically scanning rules to determine if any rules meet the triggering conditions for business data. If a rule meets the triggering conditions, the corresponding event information is sent to the event execution module.
[0041] The event execution module 204 is responsible for executing specific event logic based on the event information sent by the rule matching engine 203, so as to perform business operations on the business system.
[0042] The logging module 205 is an observable component of the event-driven center, responsible for recording relevant logs during the rule matching process and event execution, facilitating users to trace responsibility and troubleshoot problems.
[0043] It should be noted that the system architecture and application scenarios described in the embodiments of this application are for the purpose of more clearly illustrating the technical solutions of the embodiments of this application, and do not constitute a limitation on the technical solutions provided in the embodiments of this application. As those skilled in the art will know, with the evolution of system architecture and the emergence of new business scenarios, the technical solutions provided in the embodiments of this application are also applicable to similar technical problems.
[0044] Figure 3 This is a flowchart illustrating an event-driven method provided in an embodiment of this application. Exemplarily, the event-driven method provided in this embodiment can be applied to... Figure 1 In the computing device shown, in other words, it can be used... Figure 1 The computing device executes the method; specifically, the method can be executed by the processor of the computing device.
[0045] like Figure 3 As shown, the event-driven method provided in this application embodiment may include the following steps: S301. Based on the business object model, obtain standardized business data from the business system.
[0046] The business object model indicates the data fields required to drive the target event. The target event is any event to be executed in the business system, such as permission expiration reminders or automatic data updates.
[0047] In this embodiment, the business system can push raw business data to the computing device through the application program interface (API) or message queue provided by the computing device. The message queue is a core asynchronous communication and task scheduling middleware, responsible for message passing and task execution between system modules. The raw business data may differ from standardized business data in the number of fields and field naming conventions. To facilitate data unification, the computing device can standardize the raw business data according to a pre-configured business object model, extracting the business data required to drive the target event.
[0048] The business object model can be stored in the computing device in the form of a business object metadata table. By specifying the fields included, the business data obtained from the business system can be standardized and limited.
[0049] For example, the original business data is in the following format: [ { "event_id": "1", "String1 ":"System Name", "String2": "username", "String3":"Permission expiration event", "Value1":"", "Value2": "", } ] For example, the business object metadata table is shown in Table 1 below: Table 1
[0050] Referring to Table 1, if the original business data includes 5 fields (String1-3, Value1-2), while the event-driven scenario only requires 3 fields (String1-String3), the computing device can extract the data required for event-driven processing from the original business data according to the business object model to ensure data consistency.
[0051] Furthermore, the business object model can also be used for data mapping, mapping raw business data to the format required for event-driven operations. Continuing with Table 1, the raw business data contains field names, while event-driven methods primarily use these field names. Based on Table 1, the computing device can map the data in String1 to system name data, for example, mapping "String2: User a" to "Username: User 2", facilitating subsequent event-driven use.
[0052] For example, the acquired business data can be stored in the form of a table on a computing device (such as a database). This table can be called a data detail table (corresponding to Table 1 above), as shown in Table 2 below: Table 2
[0053] It should be understood that in this embodiment, the event-driven process is extracted independently from the business system, and the business data obtained from the business system is standardized through the business object model to ensure that the event-driven method of this embodiment can be compatible with multiple business systems and improve the applicability of this solution.
[0054] S302. Based on the correspondence, retrieve the target rule corresponding to the target event from the rule base.
[0055] The correspondence is used to indicate the relationship between rules and events. The rule base is pre-defined and stores detailed information about various rules.
[0056] In some implementations, such as Figure 4 As shown, object relationships can be determined in the following way.
[0057] S401. Display multiple rules and multiple events through a display device.
[0058] The display device is used to respond to user operations, associate rules and events to generate configuration information; S402. Receive configuration information sent by the display device and establish a corresponding relationship based on the configuration information.
[0059] The computing device can display detailed information about multiple rules and events on a screen via a display device. Users can associate rules and events through visual configuration operations according to actual scenario needs (e.g., establishing associations by dragging and dropping lines, or manually entering rule identifiers for events to establish associations). Furthermore, the display device generates configuration information (including identifiers of associated rules and events) and sends it to the computing device. The computing device then generates and stores the corresponding relationships based on the configuration information for later use.
[0060] For example, a display device can show an event table on the screen to display multiple events to multiple users. Additionally, the display device can also show a rule factor configuration table to display multiple rules to multiple users. For example, the event table is shown in Table 3 below: Table 3
[0061] As can be seen, the event table includes multiple fields to describe detailed event information. The interface address and invocation method indicate the specific way the event is executed, while the event parameters indicate the parameters required to execute the event. For example, in the case of an event involving automatic data updates, the event parameters can be configured to specify the parameters that need to be automatically updated.
[0062] Optionally, users can also configure events visually through the display device, such as adding, deleting, or modifying existing events. Updated events are stored in the computing device's event library.
[0063] For example, the rule factor configuration table is shown in Table 4 below: Table 4
[0064] As can be seen, the rule factor table includes multiple fields to describe detailed information about the rules. The rule type includes either a formula or a field. The source attribute and field conditions respectively define the basis for the trigger condition judgment (i.e., which fields are needed for judgment) and the judgment logic (under what circumstances the trigger condition is met). For example, if the rule type is a formula, it means that the current rule's judgment requires multiple fields to perform formula calculations. For a time-based judgment rule, the source attribute requires the current time and the permission expiration time (String3), and the judgment logic is that the subtraction result is greater than 0. For a user-based judgment rule, the source attribute requires the username (String2), and the judgment logic is that the current user is user 'a'. Values can be used to record the result of the rule judgment process.
[0065] In some implementations, as shown in Table 4, the rules in the rule base also include a third field (corresponding to the rule level) and a fourth field (corresponding to the rule relationship). The third field is used to indicate other rules that have a nested relationship with the target rule; the fourth field is used to indicate other rules that have a logical operation relationship with the target rule. Here, the logical operation relationship refers to AND, OR, and NOT relationships.
[0066] For example, rule 1 and rule 2 are nested, meaning that if rule 1 is satisfied, then rule 2 is checked for satisfaction. In this case, rule 1 has a rule level of 1, and rule 2 has a rule level of 2, meaning rule 2 is a subordinate rule of rule 1.
[0067] For example, if Rule 1 and Rule 2 have a logical operation relationship, then Rule 1 and Rule 2 are considered as a whole for evaluation; that is, the target rule includes both Rule 1 and Rule 2. For instance, if Rule 1 and Rule 2 are in an "AND" relationship, it means that both Rule 1 and Rule 2 meet the trigger condition, and the target rule is considered to meet the trigger condition; otherwise, the target rule does not meet the trigger condition. If Rule 1 and Rule 2 are in an "OR" relationship, it means that either Rule 1 or Rule 2 meets the trigger condition, or both meet the trigger condition; in either case, the target rule is considered to meet the trigger condition.
[0068] By configuring the third field and the third field, multiple rules can be introduced to work together during the rule judgment process, which improves the flexibility of event-driven decision-making and meets diverse business needs.
[0069] The solution in this application decouples rules from code. Event triggering conditions can be defined through visual configuration by configuring the correspondence (e.g., modifying the event ID in Table 3 to establish the correspondence between events and rules). Furthermore, the event triggering conditions can be readjusted by modifying the correspondence without rewriting the source code. This frees developers from repetitive logic modifications, enabling event-driven systems to be reused across scenarios and reducing costs.
[0070] In some scenarios, the above S302 can be specifically implemented as follows: S3021. Determine whether the target event is valid based on the target event's metadata.
[0071] In this context, "target event valid" means that the target event is in an enabled state and the current time is within the enabled period.
[0072] S3022. If the target event is valid, determine the target rule corresponding to the target event from the rule base according to the correspondence.
[0073] Regarding S3021-S3022 above, for events, the business system may have various event execution requirements. The computing device can first filter out valid target events based on the target event's metadata. For example, the target event's metadata may include the event status and activation period fields from Table 3 above. The computing device can determine valid target events based on these two fields (e.g., event 1 is valid, event 2 is invalid), and then filter out the corresponding target rules from the rule base based on the valid target events.
[0074] By following the steps described above, we can meet users' personalized needs, allowing them to customize whether and when events are enabled, thus satisfying the requirements of various business scenarios. Furthermore, by pre-determining valid target events, we can save computing devices from the process of applying rules to ineffective events, thereby reducing the consumption of computing resources.
[0075] S303. Determine whether the business data meets the triggering conditions of the target rule, and write the target event to the message queue if it does.
[0076] Among them, the message queue is the core asynchronous communication and task scheduling middleware, which is responsible for message passing and task execution between various modules of the system.
[0077] In this embodiment, the acquired business data is the primary basis for determining the triggering conditions of the rules, ensuring that the triggering of the rules is related to the actual business. After acquiring the business data and the target rule, the computing device can scan the target object to determine whether the business data meets the triggering conditions of the target rule. If it does, the target event is written to the message queue.
[0078] For example, in combination Figure 2 To explain, after the rule matching engine determines that the business data meets the triggering conditions of the target rule, it writes the corresponding target event to the message queue of the event execution module (specifically, it may send the index information of the target event to the message queue), facilitating the execution of the target event by the event execution module. Specifically, the rule matching engine, as a message producer, produces messages related to the target event and sends them to the message queue of the event execution module. The message body of the target event-related message may include the following: event ID, rule ID, and business data ID (used to retrieve the matching business object from the data detail table). As an example, the message body format is: [ { "Event ID": "1", "Rule ID":"1", "Business Data":[1] } ] In some possible implementations, such as Figure 5 As shown, the determination of whether the business data meets the triggering conditions of the target rule in S303 above can be specifically implemented as follows: S3031. Determine the first and second fields included in the target rule.
[0079] The first field indicates the basis for determining the trigger condition, and the second field indicates the logic for determining the trigger condition.
[0080] In this embodiment, each rule in the rule base includes an attribute source (i.e., the first field) and a field condition (i.e., the second field). The attribute source indicates which fields in the business data the current rule uses to trigger the judgment. The field condition indicates the specific judgment logic, such as greater than a certain value, less than a certain value, equal to a certain value, in a certain list, in a certain range, etc.
[0081] S3032. Obtain the actual value corresponding to the first field from the business data.
[0082] For example, if the first field in the target rule indicates that String3 in the business data is the main basis for judgment, then the computing device obtains the actual value corresponding to String3 (e.g., time 1) from Table 2.
[0083] S3033. Based on the second field, determine whether the actual value satisfies the judgment logic.
[0084] For example, the computing device obtains specific judgment logic from the rules based on the second field, such as judging whether the time is within interval a. Furthermore, the computing device determines whether the business data meets the target rule by judging whether time 1 is within interval a.
[0085] S3034. If the actual value satisfies the judgment logic, determine the triggering condition that the business data meets the target rule.
[0086] If the actual value satisfies the judgment logic, the computing device determines that the business data meets the triggering conditions of the target rule, and the computing device can further execute the corresponding target event, that is, execute the following S304.
[0087] The above steps provide a specific process for rule judgment, ensuring the feasibility of this solution. Furthermore, by defining the first and second fields, the computing device can quickly locate the judgment criteria and logic during rule scanning, reducing additional computing resource consumption and improving the efficiency of rule judgment.
[0088] S304. Retrieve the target event from the message queue and execute the target event on the business system.
[0089] For example, in combination Figure 2 To explain, when the event execution module detects a new message in the message queue, it retrieves the target event and executes the specific business logic.
[0090] In one possible implementation, the message queue includes index information of the target event, and the above S304 can be specifically implemented as follows: S3041. When a new message is detected in the message queue, the index information of the target event is obtained from the message queue, and the event interface address and calling method of the target event are obtained from the event library based on the index information.
[0091] For example, in combination Figure 2 To explain, when the event execution module detects a new message in the message queue, it obtains the index information of the target event from the message body and obtains the specific execution method of the target event based on the index information (i.e., obtains the detailed information of the event from the aforementioned event table (Table 3)).
[0092] S3042. Execute the target event on the business system according to the event interface address and the calling method.
[0093] The event execution module can invoke the event interface address according to the invocation method to execute the target event on the business system. Additionally, the event execution module can also obtain the execution result of the target event.
[0094] It should be understood that by setting up a message queue, events are stored sequentially in the message queue, and consumers retrieve them on demand. This achieves asynchronous decoupling between producers and consumers, that is, separating the rule judgment process from the event execution process. The two do not need to interact in real time and do not affect each other, solving the problem of rules and events being hard-coded together in existing technologies, and improving the flexibility of event-driven processes.
[0095] In some scenarios, for notification-type events, the event table also includes the following: Table 5
[0096] Referring to Table 5, different notification methods can be configured for notification-type events. For example, notifications can be sent via SMS to a mobile phone number, via email, or via an in-system message popping up in the business system using the system's username.
[0097] In some implementations, for notification events, the event execution flow can be as follows: Figure 6 As shown: S601. When the target event is a notification event, determine the notification method and notification object based on the fifth field included in the target event.
[0098] The fifth field can indicate one or more notification methods from among the mobile phone number, email address, and system username in Table 5. Additionally, the fifth field can also indicate the notification recipient (such as the responsible person in Table 1).
[0099] S602. Determine the notification template based on the sixth field included in the target event.
[0100] S603. Based on the business data, populate the notification template to obtain the notification message.
[0101] The computing device retrieves a notification template (email, SMS, system notification, or one or more) based on the sixth field in the event table, populates the notification template with associated business data, such as permission expiration time, and receives the notification message.
[0102] S604. Send a notification message to the notification recipient according to the notification method to execute the target event on the business system.
[0103] Computing devices can send communication messages to notification recipients based on the notification method configured for the target event, such as SMS, email, system notification, or one or more, to execute the target event on the business system. This declarative, rule-based configuration pattern breaks the rigid "fixed event - fixed notification" model of existing technologies, allowing business personnel to flexibly adjust notification strategies without relying on software development.
[0104] Optionally, the event table may include a field for notification frequency, allowing users to configure the notification frequency based on the urgency of the event, such as once a day or once an hour.
[0105] In some scenarios, such as Figure 7 As shown, the event-driven method in this application embodiment further includes: S305. After executing the target event on the business system, generate and store the record log.
[0106] The log entries include the following: Information related to the target rules; Information related to the target event; Information related to the execution result of the target event (whether the execution was successful, the execution time, the processing content, etc.).
[0107] In the embodiments of this application, combined with Figure 2 To clarify, after executing the target event, the event execution module sends an execution result message to the message queue of the logging module. As an example, the message body format of the execution result message is: [ { "Event ID": "1", "Rule ID":"1", "Business Data":[1], Execution result: "Success", "Execution Time":"xxx", "Processed Content":"xxx"} ] After detecting a new message in the message queue, the logging module obtains the execution result message, extracts relevant information about the target rule, target event, and execution result from the message body, saves it in the form of a log, generates a log record, and stores it in the storage space of the computing device (the log file can be stored in the file system).
[0108] In some implementations, the log also includes: change records of target rules; change records of target events. That is, when a rule or event changes, the log also records the change process synchronously (such as the person making the change, the time of the change, and information before and after the change), making the change process traceable and ensuring the stability of the system.
[0109] By following the steps above and configuring logging to introduce monitoring and auditing mechanisms for event-driven methods, users can promptly understand whether event execution is normal and rule matching is accurate. At the same time, it can also record event or rule changes, ensuring a certain degree of traceability and meeting compliance audit requirements.
[0110] Figure 8 This is a schematic diagram illustrating a complete process provided for an embodiment of this application. For example... Figure 8 As shown, begin. 1. Configure events, rules, and their corresponding relationships.
[0111] The computing device can display multiple events and multiple rules through the display device. Users can add or modify events or rules and establish a correspondence between events and rules. The computing device will save this object relationship.
[0112] In addition, for notification events, users can also configure the notification method, notification object, notification template, etc.
[0113] 2. Access business data.
[0114] The computing device retrieves business data associated with the target event from the business system. Specifically, the business system can provide business data through API interfaces or push business data to the computing device through message queues.
[0115] 3. Rule matching The computing device uses business data and scanning rules to determine whether the business data meets the triggering conditions of the rules. If it does, the corresponding target event message is written to the message queue.
[0116] 4. Event Execution The computing device invokes the event execution module to retrieve the target event from the message queue and perform business logic processing.
[0117] 5. Log recording The computing device records relevant information about the execution of events through logs, such as execution results, target events, and corresponding rules.
[0118] It should be noted that the event-driven method in this application embodiment can be applied to scenarios where user permissions expire. The computing device can obtain the effective time of a user's permissions from business data, determine that the user's permissions have expired through time judgment rules, and then call the notification class to notify the user that the permissions have expired via SMS, email, etc.
[0119] Furthermore, the event-driven method of this application embodiment can be applied to scenarios involving the monitoring of accounting closing events. The computing device can obtain the closing time of the accounts from business data and determine whether the closing time is approaching or has already been closed based on time judgment rules. If the time judgment rules are met, a notification event is invoked to notify the user via SMS, email, etc., that the closing time is approaching or the closing time has already been reached.
[0120] The event-driven method of this application embodiment involves a computing device acquiring business data required for a target event from a business system. Based on the correspondence, it determines the target rule corresponding to the target event. Further, based on the business data, it determines whether the business data meets the triggering conditions of the target rule; if so, the corresponding target event is written to a message queue. Finally, the computing device can retrieve the target event from the message queue and execute it. In this method, the rule judgment logic and event execution logic are isolated from each other, and the message queue is configured to ensure that the rule judgment logic and event execution logic can run asynchronously, thereby decoupling events and rules and improving the flexibility of event-driven operations in the business system. Furthermore, the computing device acquires standardized business data from the business system through a business object model, ensuring that this solution is applicable to different business systems, thereby improving the versatility and applicability of this solution.
[0121] Furthermore, the visual configuration of mapping relationships allows users to define the actions to be performed when an event occurs without coding, simply by adjusting the mapping relationships. By establishing logs that cover the entire event-driven process, the system records the rules, execution results, and context information for each event trigger, supporting troubleshooting and business auditing.
[0122] As can be seen, the above mainly describes the solutions provided by the embodiments of this application from a methodological perspective. To achieve the above functions, the embodiments of this application provide corresponding hardware structures and / or software modules for executing each function. Those skilled in the art should readily recognize that, in conjunction with the modules and algorithm steps of the various examples described in the embodiments disclosed herein, the embodiments of this application can be implemented in hardware or a combination of hardware and computer software. Whether a function is executed in hardware or by computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0123] In an exemplary embodiment, this application also provides an event-driven device. This event-driven device can be the aforementioned front-end device or a processor within the front-end device. The event-driven device may include one or more functional modules for implementing the event-driven method of the above method embodiments.
[0124] For example, Figure 9 This is a schematic diagram illustrating the composition of an event-driven device provided in an embodiment of this application. Figure 9 As shown, the event-driven device 900 includes: an acquisition module 901, a determination module 902, and an execution module 903. The acquisition module 901, the determination module 902, and the execution module 903 are interconnected.
[0125] The acquisition module 901 is used to acquire standardized business data from the business system based on the business object model; wherein, the business object model is used to indicate the data fields associated with the target event; The determining module 902 is used to determine the target rule corresponding to the target event from the rule base according to the correspondence relationship; wherein the correspondence relationship is used to indicate the association relationship between the rule and the event; The determining module 902 is further configured to determine whether the business data meets the triggering condition of the target rule, and write the target event into the message queue when it does. The execution module 903 is used to retrieve the target event from the message queue and execute the target event on the business system.
[0126] Other optional implementation methods are described in the foregoing method embodiments.
[0127] This application also provides a computer-readable storage medium. All or part of the processes in the above method embodiments can be executed by computer instructions instructing related hardware; for example, the related hardware can be a processor of a computing device. The program instructions can be stored in the above-described computer-readable storage medium, and when executed, they can implement the processes of the above method embodiments. The computer-readable storage medium can be memory. The above-described computer-readable storage medium can also be an external storage device, such as a hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc. Further, the above-described computer-readable storage medium can include both memory and external storage devices. The above-described computer-readable storage medium is used to store the above-described computer program instructions and other programs and data required for the above-described software package translation.
[0128] This application also provides a computer program product comprising a computer program that, when run on a computing device, causes the computing device to execute any of the event-driven methods provided in the above embodiments.
[0129] The event-driven method of this application embodiment can be widely applied to the following industry scenarios: Financial industry: Real-time risk control, customer segmentation and rights services, compliance and audit automation.
[0130] Healthcare: Medical insurance settlement and compliance verification, automated reminders for diagnosis and treatment processes.
[0131] Retail e-commerce: dynamic configuration of promotional rules, personalized recommendations and user operations, and linkage between inventory and supply chain.
[0132] Although this application has been described herein in conjunction with various embodiments, those skilled in the art, by reviewing the accompanying drawings, disclosure, and appended claims, will understand and implement other variations of the disclosed embodiments in carrying out the claimed application. In the claims, the word "comprising" does not exclude other components or steps, and "a" or "an" does not exclude multiple instances. A single processor or other unit can implement several functions listed in the claims. While different dependent claims may recite certain measures, this does not mean that these measures cannot be combined to produce good results.
[0133] Although this application has been described in conjunction with specific features and embodiments, it is obvious that various modifications and combinations can be made thereto without departing from the spirit and scope of this application. Accordingly, this specification and drawings are merely exemplary illustrations of this application as defined by the appended claims, and are considered to cover any and all modifications, variations, combinations, or equivalents within the scope of this application. Clearly, those skilled in the art can make various alterations and modifications to this application without departing from the spirit and scope of this application. Thus, if such modifications and modifications of this application fall within the scope of the claims of this application and their equivalents, this application is also intended to include such modifications and modifications.
[0134] The above are merely specific embodiments of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. An event-driven method, characterized in that, The method includes: Based on the business object model, standardized business data is obtained from the business system; wherein, the business object model is used to indicate the data fields required to drive the target event; Based on the correspondence, the target rule corresponding to the target event is determined from the rule base; wherein, the correspondence is used to indicate the association between the rule and the event; Determine whether the business data meets the triggering condition of the target rule, and if so, write the target event into the message queue; The target event is retrieved from the message queue and executed on the business system.
2. The method according to claim 1, characterized in that, The step of determining whether the business data meets the triggering condition of the target rule includes: The target rule is defined by a first field and a second field; the first field indicates the basis for determining the trigger condition, and the second field indicates the logic for determining the trigger condition. Obtain the actual value corresponding to the first field from the business data; Based on the second field, determine whether the actual value satisfies the judgment logic; If the actual value satisfies the judgment logic, the triggering condition for the business data to satisfy the target rule is determined.
3. The method according to claim 1 or 2, characterized in that, Based on the correspondence, the target rule corresponding to the target event is determined from the rule base, including: Based on the metadata of the target event, determine whether the target event is valid; the target event being valid means that the target event is in an enabled state and the current time is during the enabled period; If the target event is valid, the target rule corresponding to the target event is determined from the rule base according to the correspondence.
4. The method according to any one of claims 1-3, characterized in that, The rules in the rule base also include a third field and a fourth field; The third field is used to indicate other rules that have a nested relationship with the target rule; The fourth field is used to indicate other rules that have a logical operation relationship with the target rule.
5. The method according to any one of claims 1-4, characterized in that, The message queue includes index information of the target event; The step of retrieving the target event from the message queue and executing the target event on the business system includes: Upon detecting a new message in the message queue, the index information of the target event is obtained from the message queue, and the event interface address and invocation method of the target event are obtained from the event database based on the index information. The target event is executed on the business system according to the event interface address and the invocation method.
6. The method according to any one of claims 1-5, characterized in that, The execution of the target event on the business system includes: When the target event is a notification event, the notification method and notification target are determined based on the fifth field included in the target event; Determine the notification template based on the sixth field included in the target event; The notification template is populated based on the business data to obtain a notification message; The notification message is sent to the notification object according to the notification method to execute the target event on the business system.
7. The method according to any one of claims 1-6, characterized in that, The method further includes: Multiple rules and multiple events are displayed via a display device; the display device is used to respond to user operations, associate rules and events to generate configuration information; The configuration information sent by the display device is received, and the corresponding relationship is established based on the configuration information.
8. The method according to any one of claims 1-7, characterized in that, The method further includes: After the target event is executed on the business system, a log is generated and stored; the log includes the following: Relevant information about the target rule; The relevant information of the target event; Information related to the execution result of the target event.
9. The method according to claim 8, characterized in that, The log also includes: The change record of the target rule; The change log of the target event.
10. A computing device, characterized in that, The computing device includes a processor and a memory; the processor is coupled to the memory. The memory is used to store computer instructions; The computer instructions are loaded and executed by the processor to enable the computing device to implement the event-driven method as described in any one of claims 1-9.