Event processing method, device, equipment and machine-readable storage medium

By performing aggregation of target events in the event stream, the problem of computing resource occupation by state machines in the prior art when processing complex events is solved, and the effect of simplifying the event processing process and saving computing resources is achieved.

CN113296933BActive Publication Date: 2025-03-14ALIBABA GROUP HOLDING LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202010818474.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-08-14
Publication Date
2025-03-14
Estimated Expiration
2040-08-14

AI Technical Summary

Technical Problem

In the prior art, state machines need to occupy more computing resources when processing complex events, resulting in the implementation process of complex event processing being more complicated and occupy more computing resources.

Method used

By obtaining the event stream, detecting the target event in the event stream that matches the preset matching conditions, and performing aggregation calculation on the target event to obtain the aggregated result to output complex events.

Benefits of technology

Through aggregation calculation, the intrinsic relationship between multiple target events can be determined, saving the calculation amount of aggregated results and reducing the computing resources required for event processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113296933B_ABST
    Figure CN113296933B_ABST
Patent Text Reader

Abstract

The present disclosure relates to an event processing method, apparatus, device and machine-readable storage medium. The present disclosure obtains an event stream, detects a target event in the event stream that matches a preset matching condition, and can process each basic event in the event stream separately to determine whether the basic event matches the preset matching condition. Further, by performing aggregation calculations on the target events to obtain aggregation results, the intrinsic relationship between the target events in the event stream that match the preset matching condition can be determined. In other words, the intrinsic relationship between multiple target events can be determined through a single aggregation calculation, without the need to determine the intrinsic relationship between different target events one by one, thereby saving the calculation amount of the aggregation result, and saving the computing resources required for complex event processing when outputting complex events according to the aggregation result.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of information technology, and in particular to an event processing method, device, equipment and machine-readable storage medium. Background Art

[0002] In computing scenarios such as the Internet and the Internet of Things (IOT), a large number of base events are often generated. For example, a timed temperature detection performed by a temperature detector in the IOT, a click operation on the user interface when a user uses a mobile phone, or a heart rate detection performed by a smart bracelet worn by a user can all be considered a base event.

[0003] Since each basic event contains less information, it is necessary to process a large number of basic events to extract useful complex events. Therefore, a complex event can be an event composed of multiple basic events. Or a complex event can also be an event derived from multiple basic events. Currently, complex event processing (CEP) is a method of tracking and analyzing the information flow about the events that occurred and drawing conclusions from them.

[0004] The prior art implements complex event processing through a state machine. Specifically, a state machine is a data model that represents a finite number of states and behaviors such as transitions and actions between these states. However, the state machine in the prior art needs to occupy more computing resources when processing complex events. Therefore, the implementation process of complex event processing is relatively complicated and occupies more computing resources. Summary of the invention

[0005] In order to solve the above technical problems or at least partially solve the above technical problems, the present disclosure provides an event processing method, device, equipment and machine-readable storage medium to simplify the event processing process and save computing resources.

[0006] In a first aspect, an embodiment of the present disclosure provides an event processing method, including:

[0007] Get the event stream;

[0008] Detecting a target event in the event stream that matches a preset matching condition;

[0009] Performing aggregation calculation on the target event to obtain an aggregation result;

[0010] Outputting a complex event according to the aggregation result.

[0011] In a second aspect, an embodiment of the present disclosure provides an event processing method, including:

[0012] Get multiple basic events generated by IoT devices;

[0013] Detecting a target event that matches a preset matching condition among the multiple basic events;

[0014] Performing aggregation calculation on the target event to obtain an aggregation result;

[0015] Outputting a complex event according to the aggregation result;

[0016] The Internet of Things device is controlled according to the complex event.

[0017] In a third aspect, an embodiment of the present disclosure provides an event processing device, including:

[0018] Acquisition module, used to obtain event stream;

[0019] A matching module, used to detect a target event in the event stream that matches a preset matching condition;

[0020] An aggregation module, used to perform aggregation calculation on the target event to obtain an aggregation result;

[0021] An output module is used to output complex events according to the aggregation results.

[0022] In a fourth aspect, an embodiment of the present disclosure provides an electronic device, including:

[0023] Memory;

[0024] Processor; and

[0025] Computer programs;

[0026] The computer program is stored in the memory and is configured to be executed by the processor to implement the method as described in the first aspect.

[0027] In a fifth aspect, an embodiment of the present disclosure provides an Internet of Things device, including:

[0028] Memory;

[0029] Processor; and

[0030] Computer programs;

[0031] The computer program is stored in the memory and is configured to be executed by the processor to implement the method as described in the second aspect.

[0032] In a sixth aspect, an embodiment of the present disclosure provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the method described in the first aspect or the second aspect.

[0033] The event processing method, apparatus, device and machine-readable storage medium provided by the embodiments of the present disclosure can obtain an event stream, detect a target event in the event stream that matches a preset matching condition, and can process each basic event in the event stream separately to determine whether the basic event matches the preset matching condition. Further, by performing aggregation calculations on the target events to obtain aggregation results, the intrinsic relationship between the target events in the event stream that match the preset matching condition can be determined. In other words, the intrinsic relationship between multiple target events can be determined through a single aggregation calculation, without the need to determine the intrinsic relationship between different target events one by one, thereby saving the amount of calculation of the aggregation results, and saving the computing resources required for event processing when outputting complex events based on the aggregation results. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0035] 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.

[0036] Figure 1 A schematic diagram of an application scenario provided by an embodiment of the present disclosure;

[0037] Figure 2 A schematic diagram of another application scenario provided by an embodiment of the present disclosure;

[0038] Figure 3 A schematic diagram of another application scenario provided by an embodiment of the present disclosure;

[0039] Figure 4 A schematic diagram of another application scenario provided by an embodiment of the present disclosure;

[0040] Figure 5 A flow chart of an event processing method provided by an embodiment of the present disclosure;

[0041] Figure 6 A schematic diagram of functional modules in a terminal device provided by an embodiment of the present disclosure;

[0042] Figure 7A schematic diagram of a state machine provided in an embodiment of the present disclosure;

[0043] Figure 8 A flow chart of another event processing method provided by an embodiment of the present disclosure;

[0044] Fig. 9 Another event processing method process provided by the embodiment of the present disclosure;

[0045] Fig.10 A schematic diagram of another state machine provided in an embodiment of the present disclosure;

[0046] Fig.11 A schematic diagram of another state machine provided in an embodiment of the present disclosure;

[0047] Fig.12 Another event processing method process provided by the embodiment of the present disclosure;

[0048] Fig.13 A schematic diagram of an application scenario provided by an embodiment of the present disclosure;

[0049] Fig.14 A schematic diagram of the structure of an event processing device provided in an embodiment of the present disclosure;

[0050] Fig.15 A schematic diagram of the structure of an electronic device provided by an embodiment of the present disclosure;

[0051] Fig.16 A schematic diagram of the structure of an Internet of Things device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION

[0052] In order to more clearly understand the above-mentioned objectives, features and advantages of the present disclosure, the scheme of the present disclosure will be further described below. It should be noted that the embodiments of the present disclosure and the features in the embodiments can be combined with each other without conflict.

[0053] In the following description, many specific details are set forth to facilitate a full understanding of the present disclosure, but the present disclosure may also be implemented in other ways different from those described herein; it is obvious that the embodiments in the specification are only part of the embodiments of the present disclosure, rather than all of the embodiments.

[0054] Generally speaking, in computing scenarios such as the Internet and IOT, real-time analysis and feedback of user behavior or device operation are often required. Specifically, user behavior or device operation can be abstracted into basic events that occur at a specific time. These basic events will be generated continuously to form an event stream. However, each basic event in the event stream contains less information, so it is necessary to process the event stream to extract useful complex events. Complex event processing is usually implemented through a state machine. Specifically, a state machine is a data model that represents a finite number of states (State) and transitions (Transition) and actions (Action) between these states (State). However, the state machine in the prior art needs to occupy more computing resources when processing complex events.

[0055] In response to the above problems, an embodiment of the present disclosure provides an event processing method, which can be specifically executed by a state machine. Specifically, the state machine can be implemented by software and / or hardware. The state machine can run in devices such as terminal devices, IoT devices or servers. Among them, common terminal devices include, for example: mobile phones, tablet computers, laptops, PDAs, mobile Internet devices (mobile internet devices, MID), wearable devices, etc., and wearable devices include, for example, smart watches, smart bracelets, pedometers, etc. IoT devices include, for example: industrial equipment, smart furniture, etc. The server can be a remote server, a cloud server or a server cluster, etc.

[0056] In the embodiments of the present disclosure, a terminal device or an IoT device can generate a basic event. A basic event can be anything with a time attribute that occurs on a terminal device or an IoT device. For example, a heart rate detection performed by a smart bracelet can be a basic event. A click operation of a user on a user interface detected by a mobile phone can be a basic event. Taking the temperature detector in industrial equipment as an example, a timed temperature detection performed by the temperature detector can be a basic event. Basic events are continuously generated to form an event stream. Specifically, the state machine uses the event processing method described in the embodiments of the present disclosure to process the basic events in the event stream.

[0057] In a possible application scenario, the device that generates the basic event and the device that runs the state machine are the same device.

[0058] like Figure 1 As shown, multiple icons are displayed on the user interface of the mobile phone 10, and icon 11 is any one of the multiple icons. When the user operates icon 11, the mobile phone 10 may be triggered to generate a basic event. Further, the state machine running in the background of the mobile phone 10 processes the basic event generated locally by the mobile phone 10.

[0059] Or Figure 2 As shown, the temperature detector 20 includes a temperature sensor, which is used to collect the ambient temperature. Each temperature collection performed by the temperature sensor can be a basic event. Further, the state machine running in the temperature detector 20 processes the basic events generated locally by the temperature detector 20.

[0060] In another possible application scenario, the device that generates the basic event and the device that runs the state machine are not the same device.

[0061] like Figure 3 As shown, the IoT device 31 sends the basic events it generates to the mobile phone 10, and the mobile phone 10 runs a state machine, which processes the basic events generated by the IoT device 31. It can be understood that multiple state machines can be run in the IoT device 31, and different state machines are used to process basic events generated by different IoT devices, or the same state machine processes basic events generated by different IoT devices at different times.

[0062] It is understandable that, when the device generating the basic event and the device running the state machine are not the same device, the state machine in the terminal device is not limited to processing the basic events generated by the IoT device. Figure 4 As shown, after the mobile phone 10 and / or the IoT device 31 generates a basic event, the basic event can also be sent to the server 40, so that the state machine running in the server 40 can process the basic event generated by the mobile phone 10 and / or the IoT device 31. Similarly, multiple state machines can be run in the server, and different state machines are used to process basic events generated by different terminal devices or different IoT devices, or the same state machine processes basic events generated by different terminal devices or different IoT devices at different times.

[0063] The event processing method is described in detail below in conjunction with a specific embodiment. Figure 5 As shown, the specific steps of this method are as follows:

[0064] S501: Obtain event stream.

[0065] This embodiment is schematically described by taking the example of a terminal device generating an event stream and a state machine running in the terminal device processing the event stream. For example, the terminal device may display a user interface, and a user's click operation on an icon in the user interface at a certain moment may be abstracted into a basic event occurring at that moment. Alternatively, the terminal device updates the user interface once as a basic event. Basic events can be generated continuously to form an event stream.

[0066] like Figure 6As shown, the terminal device may include the following modules, for example, a rule pre-compilation module, a state machine, an input module and an output module. Among them, the rule pre-compilation module is used to compile or translate the preset rules into a state machine. The preset rule can be a business rule, or a rule determined based on a large number of basic events. The preset rule can also be called a calculation mode, an event mode or a matching mode. Among them, the calculation mode can be used to describe how to handle complex events. The event mode is a general term for a series of interrelated basic events, and each event mode contains multiple basic events executed sequentially. The input module is used to input an event stream into the state machine. The event stream includes basic events, and the basic events can be generated in real time. The state machine is used to process the basic events in the event stream in real time to obtain complex events. The output module is used to output complex events. It can be understood that, Figure 6 The modules shown are only a logical division and do not limit the internal structure of the terminal device.

[0067] For example, the preset rule can be described as: the basic event of event type A occurs 3 times first, and then the basic event of event type B occurs 1 time, and this pattern occurs 100 times within 5 minutes. The rule pre-compilation module can compile or translate the preset rule to obtain a description of the state machine, which is described as: state A (3) -> state B -> aggregate state count (100). Among them, state A represents the matching state of event type A, state B represents the matching state of event type B, and state count represents that the sequence pattern occurs 100 times. According to the description of the state machine, the state machine can be instantiated to start the state machine. Further, an event stream is input into the state machine to make the state machine run. In this embodiment, one preset rule can correspond to one state machine. The terminal device can run multiple state machines, and different state machines correspond to different preset rules.

[0068] For example, the state machine started according to the description of the state machine as described above is as follows Figure 7 As shown, the state machine includes nodes and edges between nodes. Among them, the nodes in the state machine may specifically include: a start node, a sequence pattern matching node, an aggregate matching node and an end node. Among them, the sequence pattern matching node includes one or more sequentially connected matching nodes. The aggregate matching node includes an aggregate computing node. The edges between nodes include: event ignoring edges, node state updating edges, matching flow edges, trigger computing edges, output edges, etc.

[0069] The input module of the terminal device is specifically used to input the event stream to the start node of the state machine, and the start node can send each basic event in the event stream to the sequence pattern matching node in sequence.

[0070] S502: Detect target events in the event stream that match preset matching conditions.

[0071] For example, the sequence pattern matching node includes matching node 1 and matching node 2. Matching node 1 and matching node 2 can be used to detect target events in the event stream that match preset matching conditions. Matching node 1 and matching node 2 respectively store one or more preset matching conditions. For example, the preset matching condition in matching node 1 is used to detect basic events with event type A, and the preset matching condition in matching node 2 is used to detect basic events with event type B. When a basic event in the event stream enters matching node 1, matching node 1 can detect whether the event type of the basic event is A. If the event type of the basic event is A, the basic event can be used as the target event. Similarly, if matching node 2 detects that the event type of a basic event in the event stream is B, the basic event can be used as the target event.

[0072] S503: Perform aggregation calculation on the target event to obtain an aggregation result.

[0073] When matching node 1 detects three basic events of event type A, and matching node 2 detects one basic event of event type B, matching node 2 can trigger the aggregation computing node to perform aggregation computing and obtain the aggregation result. Specifically, the aggregation computing node can count the cumulative number of occurrences of "matching node 1 detects three basic events of event type A, and matching node 2 detects one basic event of event type B", and the cumulative number of occurrences is referred to as the cumulative number. The cumulative number can be recorded as the aggregation result. Specifically, each time matching node 2 triggers the aggregation computing node, the aggregation computing node can add 1 to the cumulative number, for example, add 1 to the cumulative number calculated last time. In this embodiment, the aggregation computing performed by the aggregation computing node is not limited to the cumulative computing, and the aggregation computing or aggregation operation in the structured query language (SQL) can generally be applied to the aggregation computing node.

[0074] S504: Output complex events according to the aggregation results.

[0075] For example, if the aggregation computing node counts the cumulative number of occurrences of "matching node 1 detected 3 basic events of event type A, and matching node 2 detected 1 basic event of event type B" within 5 minutes to be 100 times, the aggregation computing node can output the complex event to the end node. Further, the end node outputs the complex event to the output module of the terminal device. The complex event can be an event composed of the basic events of event type A detected by matching node 1 and the basic events of event type B detected by matching node 2 during the 100 cumulative processes. Alternatively, the complex event can be an event generated based on the basic events of event type A detected by matching node 1 and the basic events of event type B detected by matching node 2. For example, the complex event can be a prompt message or a control instruction, etc., or the complex event can include the average time interval between the occurrence of basic events of event type A and the average time interval between the occurrence of basic events of event type B.

[0076] It is understandable that, in some embodiments, the start node in the state machine and the input module in the terminal device may be the same module. Similarly, the end node in the state machine and the output module in the terminal device may be the same module.

[0077] The disclosed embodiment acquires the event stream, detects the target event in the event stream that matches the preset matching condition, and can process each basic event in the event stream separately to determine whether the basic event matches the preset matching condition. Further, by performing aggregation calculation on the target event to obtain the aggregation result, the intrinsic relationship between the target events in the event stream that match the preset matching condition can be determined. In other words, the intrinsic relationship between multiple target events can be determined through a single aggregation calculation, without the need to determine the intrinsic relationship between different target events one by one, thereby saving the calculation amount of the aggregation result, and saving the computing resources required for complex event processing when outputting complex events according to the aggregation result.

[0078] It is understandable that in a scenario where the device that generates the basic event and the device running the state machine are the same device, a single state machine can process the basic event generated locally. Figure 1For example, the state machine running in the background of the mobile phone 10 can detect user behavior by processing basic events triggered by the user. For example, the user interface of the mobile phone 10 is an online shopping page, and the multiple icons displayed in the online shopping page can be multiple product icons. The state machine in the mobile phone 10 can count the number of times the user clicks on different product icons. When the number of times the user clicks on different product icons is greater than or equal to a preset number of times, the state machine can generate a complex event, which can be a recommendation to the user of a product icon associated with the product icon clicked by the user. Alternatively, the complex event can be a reward information pushed to the user, such as point reward information, virtual currency reward information, etc.

[0079] by Figure 2 For example, since a state machine is running in the temperature detector 20, and the state machine can obtain the basic events generated locally by the temperature detector 20 in real time, and process the basic events. For example, the basic event generated locally by the temperature detector 20 is the ambient temperature value collected in real time by the temperature sensor. Since the ambient temperature value may change over time, or the temperature sensor may fail. Therefore, by processing the basic events, the state machine can count the fluctuations of the ambient temperature value over time. If the amplitude of the fluctuation of the ambient temperature value over time is greater than or equal to the preset amplitude, the state machine can generate a complex event. The complex event can be an alarm message, for example, indicating that the temperature sensor has failed. Alternatively, the complex event can be an ambient temperature adjustment instruction, such as a heating instruction or a cooling instruction.

[0080] In the scenario where the device that generates the basic events and the device that runs the state machine are the same device, since the state machine can obtain the local generated basic events in real time, the state machine can process the local basic events in real time, so that complex events can be predicted in advance. Furthermore, early rendering or other preprocessing can be performed based on the complex events.

[0081] Based on the above embodiment, in a scenario where the device generating the basic event and the device running the state machine are not the same device, Figure 4 For example, if the basic event generated by the mobile phone 10 and / or the IoT device 31 is a basic event involving user privacy, the mobile phone 10 and / or the IoT device 31 may not send the basic event to the server 40, but instead process the basic event involving user privacy through the state machine running locally on the mobile phone 10 and / or the IoT device 31.

[0082] In addition, it is understandable that in the scenario where the basic event generation device and the device running the state machine are not the same device, or in the scenario where the basic event generation device and the device running the state machine are the same device, the user can configure the type of basic event processed by the state machine. In other words, the user can set the basic events of preset types to be processed by the state machine, that is, among the basic events generated by the device, the basic events of preset types can be processed by the state machine, that is, some basic events can be used as objects detected by the state machine, and some basic events can not be used as objects detected by the state machine.

[0083] Figure 8 This is a flow chart of an event processing method provided by another embodiment of the present disclosure. The method includes the following steps:

[0084] S801. Obtain event stream.

[0085] like Figure 7 As shown, the start node of the state machine obtains the event stream generated locally by the terminal device.

[0086] S802: Detect, through each of the one or more first matching nodes, a target event in the event stream that matches one or more preset matching conditions in the first matching node.

[0087] like Figure 7 Matching node 1 and matching node 2 in the sequence pattern matching node shown are recorded as the first matching node. Matching node 1 and matching node 2 respectively store one or more preset matching conditions. When the event stream flows into the sequence pattern matching node, matching node 1 can detect the target event that matches one or more preset matching conditions in matching node 1. Matching node 2 can detect the target event that matches one or more preset matching conditions in matching node 2. For example, matching node 1 is specifically used to detect the basic event of event type A, and matching node 2 is specifically used to detect the basic event of event type B. Therefore, the basic event of event type A in the event stream is the target event that matches matching node 1. The basic event of event type B in the event stream is the target event that matches matching node 2.

[0088] Optionally, detecting a target event in the event stream that matches one or more preset matching conditions in the first matching node through each of the one or more first matching nodes includes: inputting each basic event in the event stream into a first target node that is in an open state among the one or more first matching nodes; if the basic event matches one or more preset matching conditions in the first target node, determining that the basic event is a target event.

[0089] For example, one of the one or more matching nodes sequentially connected in the sequence pattern matching node can be in an open state. The matching node in the open state can be recorded as the target node. Figure 7 As shown, since matching node 1 and matching node 2 are respectively recorded as the first matching node. Therefore, the matching node in the turned-on state of matching node 1 and matching node 2 can be recorded as the first target node. The first target node can change over time. For example, at a certain moment, matching node 1 is in the turned-on state. At the next moment, the matching node in the turned-on state may be matching node 2.

[0090] For example, if matching node 1 is in the open state, the basic event input by the start node to the sequence pattern matching node can be received by matching node 1. Further, matching node 1 detects whether the event type of the basic event is A. If matching node 1 determines that the event type of the basic event is not A, matching node 1 can ignore the basic event. If matching node 1 determines that the event type of the basic event is A, matching node 1 determines that the basic event is a target event.

[0091] Similarly, if matching node 2 is in the open state, the basic event input by the start node to the sequence pattern matching node can be received by matching node 2. Further, matching node 2 detects whether the event type of the basic event is B. If matching node 2 determines that the event type of the basic event is not B, matching node B can ignore the basic event. If matching node 2 determines that the event type of the basic event is B, matching node B determines that the basic event is the target event.

[0092] Optionally, if the number of target events detected by the first target node does not reach a preset number, the first target node is controlled to be in an open state.

[0093] For example, after matching node 1 detects three basic events of event type A, matching node 1 enters the closed state and matching node 2 enters the open state. When matching node 2 detects one basic event of event type B, matching node 2 enters the closed state and matching node 1 enters the open state again, and so on. In other words, matching node 1 and matching node 2 can be turned on or off alternately, that is, matching node 1 or matching node 2 can be turned on or off multiple times.

[0094] When matching node 1 is in the open state, the basic event enters matching node 1. If matching node 1 determines that the event type of the basic event is A, and the basic event is the first basic event of event type A detected by matching node 1 after this opening or the second basic event of event type A, then matching node 1 can update the node state, that is, matching node 1 can continue to remain in the open state, so that the basic event input to the sequence pattern matching node by the start node next time can also be received by matching node 1.

[0095] Optionally, if the number of target events detected by the first target node reaches a preset number, the first target node is controlled to be closed, and the next first matching node of the first target node is opened.

[0096] For example, if matching node 1 detects three basic events of event type A in sequence after being turned on this time, matching node 1 can perform matching flow, that is, matching node 1 enters the closed state to enable matching node 2 to enter the open state.

[0097] In one possible scenario, the three basic events of event type A detected by matching node 1 may be interspersed with basic events of other event types. For example, between the first basic event of event type A and the second basic event of event type A detected by matching node 1, matching node 1 receives a basic event of event type B, and matching node 1 ignores the basic event of event type B.

[0098] In another possible situation, the three basic events of event type A detected by matching node 1 may not be mixed with basic events of other event types, that is, matching node 1 detects three basic events of event type A continuously.

[0099] S803: Perform aggregation calculation on the target events detected by one or more first matching nodes to obtain an aggregation result.

[0100] For example, when matching node 1 enters the closed state and matching node 2 enters the open state, the basic event that the start node continues to input to the sequence pattern matching node can be received by matching node 2. Further, matching node 2 can detect whether the event type of the basic event is B. If the event type of the basic event is B, matching node 2 can trigger the aggregation calculation node to perform aggregation calculation. Specifically, the aggregation calculation node can perform aggregation calculation on the basic event matched by matching node 1 and the basic event matched by matching node 2 to obtain an aggregation result.

[0101] For example, the aggregation computing node can count the cumulative number of occurrences of "after matching node 1 detects three basic events of event type A, matching node 2 detects one basic event of event type B". For example, if matching node 2 triggers the aggregation computing node for the first time to perform aggregation computing, the aggregation computing node counts the cumulative number of occurrences as 1. Further, matching node 1 can enter the open state again to continue to detect basic events of event type A in the event stream. When matching node 1 detects three basic events of event type A in sequence, matching node 1 enters the closed state again, and matching node 2 enters the open state again. Matching node 2 continues to detect basic events of event type B in the event stream. When matching node 2 detects one basic event of event type B, matching node 2 triggers the aggregation computing node again to perform aggregation computing. The aggregation computing node adds 1 to the cumulative number calculated last time, and so on. That is, each time matching node 2 triggers the aggregation computing node, the aggregation computing node can add 1 to the cumulative number calculated last time. This cumulative number can be recorded as the aggregation result.

[0102] S804: Output complex events according to the aggregation results.

[0103] Optionally, outputting a complex event according to the aggregation result includes: when the aggregation result satisfies a preset aggregation condition, generating a complex event according to the target event; and outputting the complex event.

[0104] Specifically, if the aggregation result meets the preset aggregation condition, the aggregation calculation node can generate a complex event according to the target event matched by the matching node 1 and the matching node 2, and output the complex event to the end node.

[0105] For example, if the aggregation computing node counts the cumulative number of occurrences of "matching node 1 detects 3 basic events of event type A, and matching node 2 detects 1 basic event of event type B" within 5 minutes is 100 times, the aggregation computing node can generate a complex event based on the basic events of event type A detected by matching node 1 and the basic events of event type B detected by matching node 2 in the 100 cumulative times, and output the complex event to the end node.

[0106] It is understandable that the event information of the basic event includes not only the event type, but also other information. For example, event type A is "browsing the web page", and the event information of the basic event of this type includes not only the event type "browsing the web page", but also: user identification, uniform resource locator (Uniform Resource Locator, URL), web page content, etc. For example, the rule abstracted from the complex event as described above can be described as: the basic event of event type A occurs 3 times first, and then the basic event of event type B occurs 1 time, and this pattern occurs 100 times within 5 minutes, and at least 100 different URLs appear. In this case, the aggregation calculation node not only needs to count the cumulative number of occurrences of "matching node 1 detects 3 basic events of event type A, and matching node 2 detects 1 basic event of event type B", but also needs to count the number of occurrences of different URLs.

[0107] In a possible implementation, the cumulative number of occurrences of "matching node 1 detects 3 basic events of event type A, and matching node 2 detects 1 basic event of event type B" and the number of occurrences of different URLs are counted simultaneously. For example, each time matching node 2 triggers the aggregation computing node, the aggregation computing node may add 1 to the cumulative number calculated last time, and count the number of different URLs included in the basic events of event type A that matching node 1 has detected.

[0108] In another possible implementation, the aggregation computing node first counts the cumulative occurrence times of "after matching node 1 detects 3 basic events of event type A, matching node 2 detects 1 basic event of event type B". When the cumulative occurrence times is 100, the aggregation computing node counts the number of different URLs.

[0109] For example, when the cumulative number of occurrences is 100 and the number of different URLs is greater than or equal to 100, the aggregation computing node can generate a complex event based on the basic event of event type A detected by matching node 1 and the basic event of event type B detected by matching node 2 in the 100 cumulative times, and output the complex event to the end node.

[0110] In this embodiment, an event stream is input into a state machine, and the state machine includes one or more matching nodes and aggregate computing nodes that are executed sequentially. Among them, the matching node can detect the target event that matches the preset matching condition in the event stream, and the aggregate computing node can perform aggregate computing on the target event to obtain an aggregate result, and output a complex event according to the aggregate result. Since each matching node can process the basic event in the event stream separately, the aggregate computing node can perform aggregate computing on multiple basic events as target events in the event stream. Therefore, the state machine can not only analyze each basic event separately, but also analyze the internal relationship between multiple basic events. Since the state machine can perform aggregate computing on multiple basic events through an aggregate computing node, the aggregate computing only needs one aggregate computing node to achieve. If there is no aggregate computing node, the state machine may need more matching nodes to achieve functions similar to aggregate computing, and more matching nodes will increase computing resources. Therefore, by performing complex event processing with a state machine with an aggregate computing node, not only the complex event processing process can be simplified, but also computing resources can be saved. In addition, when the device generating the basic event and the device running the state machine are the same device, the user ID or device ID of each basic event in the event stream is the same. Therefore, when the aggregation computing node performs aggregation computing, the aggregation computing node can perform aggregation computing for multiple basic events generated by the same user or the same device. In other words, before the aggregation computing node performs aggregation computing, it is not necessary to distinguish or filter the basic events generated by different users or different devices, thereby further improving the efficiency of complex event processing and saving computing resources.

[0111] Fig. 9 A flow chart of an event processing method provided by another embodiment of the present disclosure. The method includes: Fig. 9 The following steps are shown:

[0112] S901. Obtain event stream.

[0113] like Fig.10 As shown, the start node of the state machine obtains the event stream generated locally by the terminal device.

[0114] S902: Detect, through each of the one or more first matching nodes, a target event in the event stream that matches one or more preset matching conditions in the first matching node.

[0115] like Fig.10As shown, matching node 1 and matching node 2 in sequence pattern matching node 1 are recorded as the first matching node. After the start node inputs the basic event to the sequence pattern matching node 1, if the matching node 1 in the sequence pattern matching node 1 is in the open state, the matching node 1 receives the basic event and detects the basic event of event type A. When matching node 1 detects three basic events of event type A, matching node 1 enters the closed state, and matching node 2 in the sequence pattern matching node 1 enters the open state. The basic events subsequently input by the start node to the sequence pattern matching node 1 can be received by matching node 2. When matching node 2 detects one basic event of event type B, matching node 2 can trigger the aggregation calculation node to perform aggregation calculation.

[0116] S903: Perform aggregation calculation on the target events detected by one or more first matching nodes to obtain an aggregation result.

[0117] The aggregation calculation node can perform aggregation calculation on the basic events matched by the matching node 1 in the sequence pattern matching node 1 and the basic events matched by the matching node 2 to obtain an aggregation result. For example, if the matching node 2 in the sequence pattern matching node 1 triggers the aggregation calculation node to perform aggregation calculation for the first time, the aggregation calculation node counts the cumulative occurrence times as 1.

[0118] S904: If the aggregation result does not meet the preset aggregation condition, create one or more second matching nodes.

[0119] Since the current cumulative number of "matching node 1 detects 3 basic events of event type A, matching node 2 detects 1 basic event of event type B" is 1, which is less than 100 times, so, if Fig.10 The state machine shown can create a new sequence pattern matching node, for example, sequence pattern matching node 2. Matching node 1 and matching node 2 in sequence pattern matching node 2 are recorded as second matching nodes.

[0120] Further, the start node stops inputting basic events to the sequence pattern matching node 1 and starts inputting basic events to the sequence pattern matching node 2.

[0121] S905. Detect, through each of the one or more second matching nodes, a target event in the event stream that matches one or more preset matching conditions in the second matching node.

[0122] like Fig.10As shown, after the start node inputs the basic event to the sequence pattern matching node 2, if the matching node 1 in the sequence pattern matching node 2 is in the open state, the matching node 1 receives the basic event and detects the basic event of event type A. After the matching node 1 detects three basic events of event type A, the matching node 1 enters the closed state, and the matching node 2 in the sequence pattern matching node 2 enters the open state. The basic events subsequently input by the start node to the sequence pattern matching node 2 can be received by the matching node 2, and the matching node 2 can detect the basic event of event type B.

[0123] S906: Perform aggregation calculation on the target events detected by the one or more first matching nodes and the target events detected by the one or more second matching nodes to obtain an aggregation result.

[0124] When the matching node 1 in the sequence pattern matching node 2 detects three basic events of event type A from the event stream, if the matching node 2 in the sequence pattern matching node 2 detects one basic event of event type B, then the matching node 2 can trigger the aggregation computing node to perform aggregation computing again. At this time, the aggregation computing node can accumulate one trigger of the matching node 2 in the sequence pattern matching node 1 and one trigger of the matching node 2 in the sequence pattern matching node 2 to obtain the cumulative number of times the aggregation computing node is triggered by the matching node 2 2. At this time, the cumulative number of times the aggregation computing node is triggered by the matching node 2 can be recorded as the updated aggregation result. Since the updated aggregation result has not yet met the preset aggregation condition, new sequence pattern matching nodes can continue to be created, for example, until the sequence pattern matching node 100 is created, so that the aggregation computing node can be triggered by 100 matching nodes 2. As Fig.10 Each sequence pattern matching node shown can detect once that "after the basic event of event type A occurs 3 times, the basic event of event type B occurs once". Therefore, when the aggregation calculation node is triggered by 100 matching nodes 2, it means that "after the basic event of event type A occurs 3 times, the basic event of event type B occurs once" appears 100 times. At this time, the aggregation result meets the preset aggregation condition.

[0125] S907: Output complex events according to the aggregation results.

[0126] For example, when the aggregation result meets the preset aggregation condition, the aggregation computing node can generate a complex event according to the basic event matched by each matching node 1 and the basic event matched by each matching node 2 in the sequence pattern matching nodes 1-100, and output the complex event to the end node.

[0127] Optionally, the method further includes: when the first matching node or the second matching node detects a target event in the event stream, storing identification information of the target event in the first matching node or the second matching node.

[0128] For example Fig.10 As shown, when the matching node 1 in each sequence pattern matching node detects a base event of event type A from the event stream, the matching node 1 can store the identification information of the base event locally. When the matching node 2 in each sequence pattern matching node detects a base event of event type B from the event stream, the matching node 2 can store the identification information of the base event locally.

[0129] like Fig.10 As shown, since 100 matching nodes 2 point to the aggregation computing node, the aggregation computing node can obtain the identification information of 100 basic events of event type B from the 100 matching nodes 2. In addition, since each matching node 2 is connected to a matching node 1, the aggregation computing node can query the identification information of the basic event of event type A stored in each of the 100 matching nodes 1 through the 100 matching nodes 2.

[0130] The disclosed embodiment creates a node set consisting of one or more matching nodes multiple times, so that the last matching node in each node set can point to an aggregate computing node, so that the aggregate computing node can quickly query the matching node pointing to the aggregate computing node. In addition, the aggregate computing node can also quickly query the matching node that does not directly point to the aggregate computing node through the matching node that directly points to the aggregate computing node. Since each matching node can store the identification information of the target event it matches, the aggregate computing node can quickly query the matching node through the aggregate computing node, so that the aggregate computing node can quickly query the identification information of the target event that needs to be aggregated and calculated, thereby improving the efficiency of complex event processing.

[0131] Optionally, the method further includes: when the first matching node or the second matching node detects a target event in the event stream, recording the target event into a shared storage.

[0132] In this embodiment, the state machine may further include shared storage. When the state machine runs on a terminal device or a physical network device, the shared storage may be a storage space of the terminal device or the physical network device. When the state machine runs on a server, the shared storage may be a storage space of the server. In other words, the state machine and the shared storage may be deployed in the same device. In some other embodiments, the state machine and the shared storage may be deployed in different devices. For example, the state machine may run on a terminal device or a physical network device, and the shared storage may be on a server.

[0133] Specifically, the shared storage may be used to store target events matched by the matching nodes. Fig.10 As shown, when matching node 1 in sequence pattern matching node 1 detects a basic event of event type A, the matching node 1 can not only record the identification information of the basic event locally, but also store the basic event in the shared storage.

[0134] Optionally, the shared storage includes a timestamp of the target event, the target event, and identification information of the target event.

[0135] For example, matching node 1 in sequence pattern matching node 1 may record in shared storage the timestamp of a basic event of event type A, the basic event itself, and identification information of the basic event, wherein the identification information of the basic event may be a globally unique identifier.

[0136] This embodiment stores the identification information of the basic events matched by the matching nodes locally, and stores the basic events themselves matched by each matching node and the identification information of the basic events in the shared storage, so that the aggregation computing node can obtain the basic events corresponding to the identification information from the shared storage based on the identification information of the basic events stored locally by the matching nodes.

[0137] Optionally, when the first matching node or the second matching node detects the target event in the event stream, the target event is recorded in the shared storage, including: when the first matching node or the second matching node detects the target event in the event stream, determining whether the shared storage includes the target event; if the shared storage includes the target event, recording the number of hits of the target event in the shared storage, the number of hits indicating the number of state machines hit by the target event.

[0138] In this embodiment, taking a terminal device as an example, the terminal device may run multiple state machines, each state machine corresponding to a different preset rule. Fig.11 As shown, state machine 1 corresponds to preset rule 1, and state machine 2 corresponds to preset rule 2. Different state machines can share the shared storage. For example, the same basic event can be input into state machine 1 and state machine 2. If the basic event matches matching node 1 in state machine 1 and matching node 1 in state machine 2, respectively, then matching node 1 in state machine 1 and matching node 1 in state machine 2 can respectively record the identification information of the basic event locally. In addition, the number of hits of the basic event can also be recorded in the shared storage. The number of hits indicates the number of state machines hit by the basic event. For example, the number of hits here is 2. As Fig.11As shown, the relevant information of the basic event occupies a row of records in the shared storage. The matching node 1 in state machine 1 and the matching node 1 in state machine 2 can share the row of records. It can be understood that different basic events matched by state machine 1 can be stored in different locations of the shared storage. Similarly, different basic events matched by state machine 2 can be stored in different locations of the shared storage. If a basic event matches both state machine 1 and state machine 2, the basic event can occupy a row of records in the shared storage.

[0139] In a feasible implementation, when the matching node 1 in the state machine 1 detects a base event of event type A, the matching node 1 can determine whether the shared storage includes the base event according to the identification information of the base event. If the shared storage does not include the base event, the matching node 1 in the state machine 1 can record the base event in the shared storage. If the shared storage already includes the base event, the matching node 1 in the state machine 1 can record the number of hits of the base event in the shared storage, for example, adding 1 to the existing number of hits.

[0140] This embodiment records the hit count of the basic event in the shared storage, where the hit count represents the number of state machines hit by the basic event. Therefore, when a basic event is hit by multiple state machines, there is no need to repeatedly record the basic event in the shared storage. Multiple state machines can share one record of the basic event in the shared storage, thereby saving storage space of the shared storage.

[0141] Optionally, after outputting a complex event, the method further includes: obtaining the number of hits of each target event corresponding to the complex event from the shared storage; if the number of hits of the target event is greater than or equal to 2, reducing the number of hits of the target event by 1; if the number of hits of the target event is 1, deleting the target event from the shared storage.

[0142] For example, when state machine 1 or state machine 2 outputs a complex event, the storage space occupied by each target event corresponding to the complex event can be released in the shared storage. Specifically, taking state machine 1 as an example, when the aggregation computing node in state machine 1 outputs a complex event, the aggregation computing node can obtain the identification information of the basic events recorded by matching node 2 and matching node 1 in state machine 1 respectively. Further, the number of hits of the basic event is obtained in the shared storage according to the identification information of the basic event. If the number of hits of the basic event is greater than or equal to 2, it means that in addition to state machine 1, there are other state machines occupying the basic event. At this time, state machine 1 can modify the number of hits of the basic event and reduce the number of hits of the basic event by 1. If the number of hits of the basic event obtained by state machine 1 from the shared storage is 1, it means that in addition to state machine 1, no other state machine occupies the basic event. At this time, state machine 1 can delete the basic event from the shared storage, for example, delete a row of records occupied by the basic event from the shared storage.

[0143] After outputting a complex event, the state machine in this embodiment obtains the hit count of each basic event corresponding to the complex event from the shared storage. When the hit count is greater than or equal to 2, the hit count of the basic event is reduced by 1; when the hit count of the basic event is reached, the basic event is deleted from the shared storage, thereby freeing up part of the storage space of the shared storage and improving the utilization rate of the shared storage.

[0144] Fig.12 A flow chart of an event processing method provided by another embodiment of the present disclosure. The method includes the following steps:

[0145] S1201. Acquire multiple basic events generated by IoT devices.

[0146] like Fig.13 As shown, the Internet of Things device 130 can specifically be a temperature regulating device. The temperature regulating device includes a temperature sensor and a temperature regulator. The temperature sensor is used to collect ambient temperature. The temperature regulator is used to regulate the ambient temperature, for example, cooling or heating. Each temperature collection performed by the temperature sensor can be a basic event. The temperature sensor generates multiple basic events when collecting temperature in real time or periodically. In addition, a state machine runs in the Internet of Things device 130, and the structure of the state machine can specifically be the structure in the several embodiments described above, which will not be repeated here. For example, the state machine in the Internet of Things device 130 adopts the following Figure 7 The state machine receives the basic events that the temperature sensor continuously generates.

[0147] S1202: Detect a target event that matches a preset matching condition among the multiple basic events.

[0148] For example, each basic event generated by the temperature sensor may include a temperature value collected by the temperature sensor. Matching node 1 in the state machine is used to detect basic events where the temperature value is lower than a first preset temperature. Matching node 2 in the state machine is used to detect basic events where the temperature value is higher than a second preset temperature.

[0149] S1203: Perform aggregation calculation on the target event to obtain an aggregation result.

[0150] For example, the aggregation calculation node in the state machine can perform aggregation calculation on the basic event that the temperature value detected by the matching node 1 is lower than the first preset temperature and the basic event that the temperature value detected by the matching node 2 is higher than the second preset temperature to obtain an aggregation result. The aggregation result can specifically be the number of occurrences of the basic event that the temperature value is lower than the first preset temperature and the number of occurrences of the basic event that the temperature value is higher than the second preset temperature.

[0151] S1204: Output complex events according to the aggregation results.

[0152] When the number of occurrences of the basic event that the temperature value is lower than the first preset temperature reaches a preset number, such as 100 times, and the number of occurrences of the basic event that the temperature value is higher than the second preset temperature reaches a preset number, such as 100 times, the aggregation computing node can generate a complex event based on the 100 basic events that the temperature value is lower than the first preset temperature and the 100 basic events that the temperature value is higher than the second preset temperature. The complex event can specifically include the average value of the 100 low temperature values ​​and the average value of the 100 high temperature values. Alternatively, the complex event can be a temperature adjustment instruction.

[0153] S1205: Control the IoT device according to the complex event.

[0154] Further, the aggregate computing node may send the complex event to a temperature regulator. Further, the temperature regulator performs temperature regulation according to the complex event.

[0155] like Fig.13 As shown, the device that generates the basic event and the device running the state machine are the same IoT device 130. In some other embodiments, the IoT device 130 can also send the basic events it generates to the terminal device or server. The terminal device or server runs a state machine. When the state machine in the terminal device or server generates a complex event based on the basic event of the IoT device 130, the terminal device or server can send the complex event to the IoT device 130, so that the IoT device 130 adjusts the temperature according to the complex event. Similarly, Figure 3As shown, after the state machine in the mobile phone 10 processes the basic event generated by the IoT device 31 to obtain a complex event, the mobile phone 10 sends the complex event to the IoT device 31. Figure 4 As shown, after the state machine running in the server 40 processes the basic events generated by the mobile phone 10 and / or the IoT device 31 to obtain complex events, the server 40 sends the complex events to the mobile phone 10 and / or the IoT device 31.

[0156] This embodiment obtains basic events generated locally by the IoT device through a state machine running in the IoT device, processes the basic events to obtain complex events, and further locally controls the IoT device based on the complex events, thereby saving the computational complexity of the complex event processing process of the IoT device.

[0157] The disclosed embodiment also provides an event processing device.

[0158] Fig.14 The event processing device provided in the embodiment of the present disclosure can execute the processing flow provided in the event processing method embodiment, such as Fig.14 As shown, the event processing device 140 includes:

[0159] The acquisition module 1401 is used to acquire the event stream;

[0160] A detection module 1402 is used to detect a target event in the event stream that matches a preset matching condition;

[0161] Aggregation module 1403, used to perform aggregation calculation on the target event to obtain an aggregation result;

[0162] The output module 1404 is used to output complex events according to the aggregation results.

[0163] Optionally, the event processing device 140 further includes a generation module 1405 ; the generation module 1405 is used to generate a complex event according to the target event when the aggregation result meets a preset aggregation condition; the output module 1404 is used to output the complex event.

[0164] Optionally, when the detection module 1402 detects a target event in the event stream that matches a preset matching condition, it is specifically used to: detect a target event in the event stream that matches one or more preset matching conditions in the first matching node through each first matching node in one or more first matching nodes.

[0165] Optionally, when the detection module 1402 detects a target event in the event stream that matches one or more preset matching conditions in the first matching node through each of the one or more first matching nodes, it is specifically configured to:

[0166] Input each basic event in the event stream into a first target node in the one or more first matching nodes that is in an open state;

[0167] If the basic event matches one or more preset matching conditions in the first target node, the basic event is determined to be a target event.

[0168] Optionally, the event processing device 140 also includes: a control module 1406, and the control module 1406 is used to control the first target node to close and open the next first matching node of the first target node if the number of target events detected by the first target node reaches a preset number.

[0169] Optionally, the control module 1406 is further configured to: if the number of target events detected by the first target node does not reach a preset number, control the first target node to be in an on state.

[0170] Optionally, the aggregation module 1403 performs aggregation calculation on the target event to obtain an aggregation result, which is specifically used for:

[0171] Aggregation calculation is performed on target events detected by one or more first matching nodes to obtain an aggregation result.

[0172] Optionally, the event processing device 140 also includes: a creation module 1407, where the creation module 1407 is used to create one or more second matching nodes if the aggregation result does not meet the preset aggregation conditions; the detection module 1402 is also used to: detect the target event in the event stream that matches the one or more preset matching conditions in the second matching node through each of the one or more second matching nodes; the aggregation module 1403 is also used to: perform aggregation calculations on the target events detected by the one or more first matching nodes and the target events detected by the one or more second matching nodes to obtain an aggregation result.

[0173] Optionally, the event processing device 140 further includes: a storage module 1408, and the storage module 1408 is used to store identification information of the target event in the first matching node or the second matching node when the first matching node or the second matching node detects the target event in the event flow.

[0174] Optionally, the event processing device 140 further includes: a recording module 1409, configured to record the target event into a shared storage when the first matching node or the second matching node detects a target event in the event stream.

[0175] Optionally, the shared storage includes a timestamp of the target event, the target event, and identification information of the target event.

[0176] Optionally, the recording module 1409 is specifically used to: when the first matching node or the second matching node detects the target event in the event stream, determine whether the shared storage includes the target event; if the shared storage includes the target event, then record the number of hits of the target event in the shared storage, and the number of hits indicates the number of state machines hit by the target event.

[0177] Optionally, the acquisition module 1401 is also used to obtain the number of hits of each target event corresponding to the complex event from the shared storage after the output module 1404 outputs the complex event; the control module 1406 is also used to reduce the number of hits of the target event by 1 if the number of hits of the target event is greater than or equal to 2; if the number of hits of the target event is 1, delete the target event from the shared storage.

[0178] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0179] The above describes the internal functions and structure of the event processing device, which can be implemented as an electronic device. Fig.15 This is a schematic diagram of the structure of an electronic device embodiment provided by the present disclosure. Fig.15 As shown, the electronic device includes a memory 151 and a processor 152 .

[0180] The memory 151 is used to store programs. In addition to the above programs, the memory 151 can also be configured to store various other data to support operations on the electronic device. Examples of such data include instructions for any application or method operating on the electronic device, contact data, phone book data, messages, pictures, videos, etc.

[0181] The memory 151 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.

[0182] The processor 152 is coupled to the memory 151 and executes the program stored in the memory 71 to:

[0183] Get the event stream;

[0184] Detecting a target event in the event stream that matches a preset matching condition;

[0185] Performing aggregation calculation on the target event to obtain an aggregation result;

[0186] Outputting a complex event according to the aggregation result.

[0187] Further, if Fig.15 As shown, the electronic device may also include: a communication component 153, a power component 154, an audio component 155, a display 156 and other components. Fig.15 Only some components are shown schematically, which does not mean that the electronic device only includes Fig.15 Components shown.

[0188] The communication component 153 is configured to facilitate wired or wireless communication between the electronic device and other devices. The electronic device can access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 153 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 153 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.

[0189] The power supply component 154 provides power to various components of the electronic device. The power supply component 154 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the electronic device.

[0190] The audio component 155 is configured to output and / or input audio signals. For example, the audio component 155 includes a microphone (MIC), and when the electronic device is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode, the microphone is configured to receive an external audio signal. The received audio signal may be further stored in the memory 151 or sent via the communication component 153. In some embodiments, the audio component 155 also includes a speaker for outputting audio signals.

[0191] The display 156 includes a screen, which may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from a user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of a touch or slide action, but also detect the duration and pressure associated with the touch or slide operation.

[0192] Fig.16 The schematic diagram of the structure of the Internet of Things device provided by the embodiment of the present disclosure is as follows. The Internet of Things device provided by the embodiment of the present disclosure can execute the processing flow provided by the above method embodiment, such as Fig.16 As shown, the Internet of Things device 160 includes: a memory 161, a processor 162, a computer program and a communication interface 163; wherein the computer program is stored in the memory 161 and is configured so that the processor 162 executes the method as described above.

[0193] In addition, the embodiments of the present disclosure further provide a computer-readable storage medium on which a computer program is stored, and the computer program is executed by a processor to implement the methods described in the above embodiments. A person of ordinary skill in the art can understand that all or part of the steps of implementing the above method embodiments can be completed by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, the execution includes the steps of the above method embodiments; and the aforementioned storage medium includes: ROM, RAM, disk or optical disk and other media that can store program codes.

[0194] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present disclosure, rather than to limit them. Although the present disclosure has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein by equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present disclosure.

Claims

1. An event processing method, characterized in that: The method comprises: Get the event stream; Detecting a target event in the event stream that matches a preset matching condition; Performing aggregation calculation on the target event to obtain an aggregation result; Outputting a complex event according to the aggregation result; Detecting a target event in the event stream that matches a preset matching condition includes: Detecting, by each of the one or more first matching nodes, a target event in the event stream that matches one or more preset matching conditions in the first matching node; Aggregate the target event to obtain an aggregate result, including: Performing aggregation calculation on target events detected by one or more first matching nodes to obtain an aggregation result; If the aggregation result does not meet the preset aggregation condition, creating one or more second matching nodes; Detecting, by each of the one or more second matching nodes, a target event in the event stream that matches one or more preset matching conditions in the second matching node; Performing aggregation calculation on the target events detected by the one or more first matching nodes and the target events detected by the one or more second matching nodes to obtain an aggregation result; When the first matching node or the second matching node detects a target event in the event stream, recording the target event into a shared storage; When the first matching node or the second matching node detects a target event in the event stream, recording the target event into a shared storage includes: When the first matching node or the second matching node detects a target event in the event stream, determining whether the shared storage includes the target event; If the shared storage includes the target event, the hit count of the target event is recorded in the shared storage, where the hit count indicates the number of state machines hit by the target event.

2. The method according to claim 1, characterized in that Output complex events according to the aggregation results, including: When the aggregation result meets the preset aggregation condition, a complex event is generated according to the target event; The complex event is output.

3. The method according to claim 1, characterized in that Detecting a target event in the event stream that matches one or more preset matching conditions in the first matching node through each of the one or more first matching nodes includes: Input each basic event in the event stream into a first target node in the one or more first matching nodes that is in an open state; If the basic event matches one or more preset matching conditions in the first target node, the basic event is determined to be a target event.

4. The method according to claim 3, characterized in that The method further comprises: If the number of target events detected by the first target node reaches a preset number, the first target node is controlled to be closed, and the next first matching node of the first target node is opened.

5. The method according to claim 3, characterized in that: The method further comprises: If the number of target events detected by the first target node does not reach a preset number, the first target node is controlled to be in an open state.

6. The method according to claim 1, characterized in that The method further comprises: When the first matching node or the second matching node detects a target event in the event stream, identification information of the target event is stored in the first matching node or the second matching node.

7. The method according to claim 1, characterized in that The shared storage includes the timestamp of the target event, the target event, and identification information of the target event.

8. The method according to claim 1, characterized in that After outputting the complex event, the method further includes: Acquire the hit count of each target event corresponding to the complex event from the shared storage; If the hit count of the target event is greater than or equal to 2, the hit count of the target event is reduced by 1; If the hit count of the target event is 1, the target event is deleted from the shared storage.

9. An event processing method, characterized in that: The method comprises: Get multiple basic events generated by IoT devices; Detecting a target event that matches a preset matching condition among the multiple basic events; Performing aggregation calculation on the target event to obtain an aggregation result; Outputting a complex event according to the aggregation result; Controlling the IoT device according to the complex event; Detecting a target event that matches a preset matching condition among the multiple basic events includes: Detecting, by each of the one or more first matching nodes, a target event among the multiple basic events that matches one or more preset matching conditions in the first matching node; Aggregate the target event to obtain an aggregate result, including: Performing aggregation calculation on target events detected by one or more first matching nodes to obtain an aggregation result; If the aggregation result does not meet the preset aggregation condition, creating one or more second matching nodes; Detecting, by each of the one or more second matching nodes, a target event in the plurality of basic events that matches one or more preset matching conditions in the second matching node; Performing aggregation calculation on the target events detected by the one or more first matching nodes and the target events detected by the one or more second matching nodes to obtain an aggregation result; When the first matching node or the second matching node detects a target event among the multiple basic events, the target event is recorded in the shared storage; When the first matching node or the second matching node detects a target event among the multiple basic events, recording the target event into a shared storage includes: When the first matching node or the second matching node detects a target event among the multiple basic events, determining whether the shared storage includes the target event; If the shared storage includes the target event, the hit count of the target event is recorded in the shared storage, where the hit count indicates the number of state machines hit by the target event.

10. An event processing device, characterized in that: include: Acquisition module, used to obtain event stream; A matching module, used to detect a target event in the event stream that matches a preset matching condition; An aggregation module, used to perform aggregation calculation on the target event to obtain an aggregation result; An output module, used for outputting complex events according to the aggregation results; A matching module, configured to: detect, through each of the one or more first matching nodes, a target event in the event stream that matches one or more preset matching conditions in the first matching node; An aggregation module, used to perform aggregation calculation on target events detected by one or more first matching nodes to obtain an aggregation result; A creation module, configured to create one or more second matching nodes if the aggregation result does not meet a preset aggregation condition; The detection module is further used to: detect a target event in the event stream that matches one or more preset matching conditions in the second matching node through each of the one or more second matching nodes; The aggregation module is further used to: perform aggregation calculation on the target events detected by the one or more first matching nodes and the target events detected by the one or more second matching nodes to obtain an aggregation result; A recording module, configured to record the target event into a shared storage when the first matching node or the second matching node detects a target event among the multiple basic events; Logging module, specifically used for: When the first matching node or the second matching node detects a target event among the multiple basic events, determining whether the shared storage includes the target event; If the shared storage includes the target event, the hit count of the target event is recorded in the shared storage, where the hit count indicates the number of state machines hit by the target event.

11. An electronic device, characterized in that: include: Memory; processor; as well as Computer programs; The computer program is stored in the memory and is configured to be executed by the processor to implement the method according to any one of claims 1 to 9.

12. An Internet of Things device, characterized in that: include: Memory; processor; as well as Computer programs; The computer program is stored in the memory and is configured to be executed by the processor to implement the method according to claim 9.

13. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 9 is implemented.

Citation Information

Patent Citations

  • Method and system for scalable complex event processing of event streams

    US20180107530A1