CN112631740A - Event processing method and device, terminal and computer readable storage medium - Google Patents
Event processing method and device, terminal and computer readable storage medium Download PDFInfo
- Publication number
- CN112631740A CN112631740A CN201910907179.1A CN201910907179A CN112631740A CN 112631740 A CN112631740 A CN 112631740A CN 201910907179 A CN201910907179 A CN 201910907179A CN 112631740 A CN112631740 A CN 112631740A
- Authority
- CN
- China
- Prior art keywords
- data
- rule
- event processing
- reported
- memory
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000003672 processing method Methods 0.000 title claims abstract description 41
- 238000012545 processing Methods 0.000 claims abstract description 73
- 230000000875 corresponding effect Effects 0.000 claims description 68
- 238000013507 mapping Methods 0.000 claims description 32
- 238000000034 method Methods 0.000 claims description 28
- 238000004364 calculation method Methods 0.000 claims description 20
- 230000009471 action Effects 0.000 claims description 19
- 238000004590 computer program Methods 0.000 claims description 13
- 238000004891 communication Methods 0.000 claims description 10
- 230000001276 controlling effect Effects 0.000 claims description 5
- 238000006243 chemical reaction Methods 0.000 claims description 2
- 230000002776 aggregation Effects 0.000 abstract description 11
- 238000004220 aggregation Methods 0.000 abstract description 11
- 230000000694 effects Effects 0.000 abstract description 6
- 238000005516 engineering process Methods 0.000 abstract description 5
- 238000004458 analytical method Methods 0.000 description 7
- 230000008569 process Effects 0.000 description 7
- 238000010586 diagram Methods 0.000 description 6
- 230000006855 networking Effects 0.000 description 6
- 206010039203 Road traffic accident Diseases 0.000 description 3
- 230000006870 function Effects 0.000 description 3
- 241000282414 Homo sapiens Species 0.000 description 2
- 230000032683 aging Effects 0.000 description 2
- 230000004888 barrier function Effects 0.000 description 2
- 230000005540 biological transmission Effects 0.000 description 2
- QVFWZNCVPCJQOP-UHFFFAOYSA-N chloralodol Chemical compound CC(O)(C)CC(C)OC(O)C(Cl)(Cl)Cl QVFWZNCVPCJQOP-UHFFFAOYSA-N 0.000 description 2
- 238000002372 labelling Methods 0.000 description 2
- 230000007246 mechanism Effects 0.000 description 2
- 238000005192 partition Methods 0.000 description 2
- 230000002265 prevention Effects 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
- 239000002131 composite material Substances 0.000 description 1
- 238000001514 detection method Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 230000018109 developmental process Effects 0.000 description 1
- 238000001914 filtration Methods 0.000 description 1
- 230000002045 lasting effect Effects 0.000 description 1
- 238000007726 management method Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000011160 research Methods 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 230000007723 transport mechanism Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/466—Transaction processing
- G06F9/467—Transactional memory
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/12—Protocols specially adapted for proprietary or special-purpose networking environments, e.g. medical networks, sensor networks, networks in vehicles or remote metering networks
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- General Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Health & Medical Sciences (AREA)
- Signal Processing (AREA)
- Computer Networks & Wireless Communication (AREA)
- Medical Informatics (AREA)
- Health & Medical Sciences (AREA)
- Computing Systems (AREA)
- Information Transfer Between Computers (AREA)
Abstract
The embodiment of the invention provides an event processing method, an event processing device, a terminal and a computer readable storage medium. The invention also provides an event processing device, a terminal and a computer readable storage medium, and through the implementation of the invention, the technical problems that no effective solution is available for the problem of the complex event rules, especially the aggregation type rules, and the user experience is low in the current related technology are solved, the effective solution for the problem of the complex event rules, especially the aggregation type rules, is provided, and the technical effect of improving the user experience is achieved.
Description
Technical Field
The embodiment of the invention relates to the field of internet of things and edge computing, in particular to but not limited to an event processing method, device, terminal and computer-readable storage medium.
Background
The Internet of Things, is an extension of the Internet and is a future development direction. At present, the internet of fire and heat can be understood as tightly connecting human beings, while the internet of things connects human beings and various objects (i.e. equipment) together, firstly, the number of the connections is at least an order of magnitude higher, secondly, the objects are also connected into the network, and the linkage of people and objects and the linkage of objects and objects can generate a plurality of valuable application scenes.
What is an event? In daily life, an "event" indicates the occurrence of an event, and in CEP, an "event" is an object directed to computer processing that marks or records an activity that occurs. In short, an event is the object of a record of some activity in the system. Events mark activities, and there may be associations between one event and other events.
Complex Event Processing (CEP) is an analysis technique based on Event streams in a dynamic environment, where events generally refer to meaningful state changes, and by analyzing relationships among the events, using techniques such as filtering, association, aggregation, etc., a detection rule is formulated according to a time sequence relationship and an aggregation relationship among the events, an Event sequence meeting requirements is continuously queried from the Event streams, and finally, a more Complex composite Event is obtained through analysis, and the method is mainly used for crime prevention such as phishing and fraud identification, financial industry prevention such as banking, etc., and risk and marketing evasion decisions.
Edge computing technology, as another key technology of the internet of things, is also a hot spot of current research. When cloud computing is started, a view has been provided that a terminal only needs one display screen, all data of the internet of things are transmitted to a cloud center, and the cloud completes the operation process and then transmits the data back to the terminal of a user. Thin terminals will therefore be a future trend.
However, the efficiency of the internet of things cannot be expected due to the fact that the cloud center is excessively relied on, and particularly in a scene with strict time delay requirements, deployment of the internet of things is meaningless. For example, in a car networking scenario, a vehicle is required to react to data of each sensor in an extreme time, and if the data is transmitted to a cloud for analysis and processing and then returned, serious traffic accidents may be caused due to time consumption.
The definition of 'edge computing' in the industry means that an open platform fusing network, computing, storage and application core capabilities is provided on the edge side of a network close to an object or a data source, so that edge intelligent services are provided nearby.
At present, each large internet of things platform provides an edge computing function, and the edge node supports the execution of a rule engine, but the supported rules are simple, and the execution cannot be supported by complex event rules, especially aggregation type rule edge nodes. For example, a user needs to calculate an event with an average temperature of more than 20 degrees and lasting for 30 minutes, or a complex event with a maximum humidity of more than 50% observed for the last 20 times, and the like, and each large property network platform in the industry does not provide an effective solution.
Disclosure of Invention
The event processing method, the event processing device, the terminal and the computer readable storage medium mainly solve the technical problem that no effective solution is available for the problem of complex event rules, especially aggregation type rules in the prior art, and the method in the prior art is complex, large in memory occupation, long in time consumption and low in user experience.
To solve the foregoing technical problem, an embodiment of the present invention provides an event processing method, including:
acquiring reported data of equipment;
acquiring a rule corresponding to the equipment;
distributing the reported data according to the rule;
storing the reported data in a corresponding memory data set;
acquiring target data from the memory data set, wherein the target data at least comprises the reported data and is data required by matching the rule;
and calculating the target data and matching the rule.
An embodiment of the present invention further provides an event processing apparatus, where the event processing apparatus includes:
the first acquisition module is used for acquiring the reported data of the equipment;
the second acquisition module is used for acquiring the rule corresponding to the equipment;
the distribution module is used for distributing the reported data according to the rule;
the memory data set is used for storing corresponding reported data;
a third obtaining module, configured to obtain target data from the memory data set, where the target data at least includes the reported data, and the target data is data required to match the rule;
and the calculation matching module is used for calculating the target data and matching the rule.
An embodiment of the present invention further provides an event processing terminal, where the event processing terminal includes: a processor, a memory, and a communication bus;
the communication bus is used for realizing connection communication between the processor and the memory;
the processor is configured to execute one or more computer programs stored in the memory to implement the steps of the event processing method as described in any one of the above.
Embodiments of the present invention also provide a computer-readable storage medium storing one or more computer programs, which are executable by one or more processors to implement the steps of the event processing method according to any one of the above.
The invention has the beneficial effects that:
the event processing method includes the steps of acquiring reported data of equipment and rules corresponding to the equipment, distributing the reported data according to the rules and storing the distributed reported data in corresponding memory data sets, acquiring target data from the memory data sets, wherein the target data at least comprise the reported data, and the target data are data required by matching the rules, and are calculated and matched with the rules. The method is simple, consumes less time and improves user experience.
Additional features and corresponding advantages of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention.
Drawings
Fig. 1 is a schematic flowchart of an event processing method according to an embodiment of the present invention;
fig. 2 is a schematic flowchart of an embodiment of an event processing method according to the present invention;
fig. 3 is a structural diagram of an event processing apparatus according to a second embodiment of the present invention;
fig. 4 is a networking diagram of an internet of things cloud and an edge node of an event processing apparatus according to a second embodiment of the present invention;
FIG. 5 is a schematic diagram of a second embodiment of the present invention when an event processing apparatus is an edge node;
fig. 6 is a schematic structural diagram of an event processing terminal according to a third embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, embodiments of the present invention are described in detail below with reference to the accompanying drawings. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
The first embodiment is as follows:
referring to fig. 1, an event processing method provided in this embodiment includes:
s101: acquiring reported data of equipment;
s102: acquiring a rule corresponding to equipment;
s103: distributing the reported data according to rules;
s104: storing the reported data in a corresponding memory data set;
s105: acquiring target data from the memory data set;
s106: target data is calculated and rules are matched.
In some embodiments, the event processing method is applied to the internet of things, where the reported data of the device may be obtained after a reported data obtaining instruction is directly sent to the device; or the device can report actively and directly receive the reported data of the device; or converting the data into the reported data of the equipment based on the instruction of the user.
In some embodiments, before acquiring the report data of the device, the method further includes: and establishing a mapping relation between the equipment and the rule and a mapping relation between the rule and the memory data set, wherein the mapping relation between the rule and the memory data set is one-to-one mapping. It should be noted that the mapping relationship between the devices and the rules may be in the form of one device mapping one rule, one device mapping multiple rules, multiple devices mapping one rule, and the like, and is not limited in the embodiment of the present invention. The mapping relation between the equipment and the rule can be matched with the rule through the identification information of the equipment, so that the subsequent matching with the corresponding rule can be realized through the identification information of the equipment. Wherein the identification information of the device may be a device serial number. The labeling mode of the identification information of the device may be set according to an industry rule or may be set by a user, but it should be noted that the identification information of the device is different among devices in one event processing process.
In some embodiments, the rules are configured on the cloud platform side.
In some embodiments, the rule corresponding to the obtaining device may be a rule corresponding to the matching by reporting device identification information included in the data. The equipment identification information may be an equipment serial number, such as an IMEI code of the handset, etc.
In some embodiments, when one device corresponds to a plurality of rules, the reporting data of the device is shunted by a corresponding amount according to the rules. For example, the device a corresponds to three rules a, b, and c, and the three rules a, b, and c respectively correspond to D, E, F memory data sets, and at this time, the reported data F of the device a is split three times according to the three rules a, b, and c, where the split is three same reported data F1, F2, and F3, and it is required to say that the three reported data F1, F2, F3 are consistent with the three reported data F. And correspondingly storing F1, F2 and F3 in D, E, F three memory data sets respectively.
It should be noted that, when the rule corresponding to the device is not obtained, that is, when the device does not have a matching rule before, the obtained reported data is directly released, and no subsequent processing is performed.
It should be noted that, in some embodiments, the memory data set is a rule-based granularity, and a logical partition is established in the memory for each rule to form the memory data set.
It should be noted that the target data at least includes the reported data, and the target data is data required by the matching rule.
In some embodiments, when the target data is more than the report data, the memory data set also stores historical report data; at this time, the target data includes report data and target history report data. It should be noted that the historical report data is report data acquired before the time point at which the current report data is acquired and/or report data acquired at the same time as the time point at which the current report data is acquired. The data source of the historical reported data may be the same device as the current device reporting the data, or may be derived from other devices different from the device reporting the data, but at least one common rule exists in the rules respectively corresponding to the other devices and the current device. For example, at time T1, device a reporting data a is acquired, at time T0, device c reporting data B, C and device d reporting data E are acquired, at time T0 is before time T1, at least one common rule exists among the rules corresponding to devices a, c and d, and B, C, E stored in the memory data set corresponding to the common rule is history reporting data.
In some embodiments, calculating the target data and matching the rules comprises: the sliding window calculates the target data and matches the rules.
In some embodiments, after an aging mechanism is applied to the historical reported data stored in the memory dataset, that is, after the target data is calculated and matched with the rule by the sliding window, the method further includes: and releasing the historical reported data which are stored in the memory data set and exceed the sliding window. It can be understood that the calculated sliding window will shift one grid when the next piece of reported data is acquired or received. For example, if the current rule is to calculate the average value of the last 20 times of data reported by the temperature sensor, the historical reported data stored in the memory data set may be 20 times, and the current reported data is added to the historical reported data for 21 times in total. According to the rule, the sliding window only needs 20 times of reported data including the current reported data, the earliest 21 st time of historical reported data is the historical reported data exceeding the sliding window, and at the moment, the 21 st time of historical reported data is released from the memory data set. For another example, if the current rule is to calculate the number of input words in the last 20 minutes, and the current time is 15 hours and 20 minutes, after the number of input words in 15 hours and 20 minutes is acquired as the report data, the data memory set corresponding to the rule actually includes the number of input words in 21 minutes from 14 hours and 59 minutes to 15 hours and 20 minutes, and since the condition of the rule is that the number of input words in the last 20 minutes needs to be calculated, it is obvious that the history report data in 14 hours and 59 minutes is not within the calculation range of the sliding window, at this time, the history report data before 15 hours can be released.
It should be noted that the time for releasing the historical reported data may be after the target data is calculated and matched with the rule in the sliding window, or may be when the uploaded data is saved, the earliest data is directly released according to the memory capacity. The method is similar to the principle that the storage of the image data by the memory card in the automobile data recorder is to cover the earliest data in real time.
In some embodiments, before splitting the report data according to the rule, the method further includes:
if the format of the reported data is inconsistent with the preset format, the format of the reported data is converted into the preset format, and then the reported data is distributed according to the rule.
It should be noted that the format of the reported data may be understood as the language type of the reported data, and may also be understood as the type of the transmission protocol of the reported data, and those skilled in the art may set the format according to their needs. For example, when the current device a and the current device B both have a mapping relationship with the rule a, and after the reported data C of the device a and the reported data D of the device B are obtained, if the reported data C is an MQTT protocol, the reported data D is an LORA protocol, and the preset format is the MQTT protocol, the protocol type of the reported data D is converted into the MQTT protocol, and then the reported data are shunted according to the rule.
In some embodiments, the above event processing method is applied to at least one of: the internet of things comprises an internet of things cloud and edge nodes.
When the time processing method is applied to the edge node, it should be noted that the rule may be configured at the cloud of the internet of things and then issued to the edge node related to the rule for calculation. For example, in the car networking scenario, the vehicles are required to react to the data of each sensor in a very short time, and if the data are transmitted to the cloud for analysis and processing and then returned, serious traffic accidents may be caused. The vehicle enterprise can configure the internet of things rule at the cloud of the internet of things, if the distance sensor detects a certain distance from a barrier, the vehicle enterprise can trigger the active braking system to send to a processing system in a vehicle as an edge node, and the vehicle enterprise is responsible for receiving sensor data, processing the rule and triggering the rule action, and does not directly transmit the data to the cloud for processing. The method can trigger one-time active braking on the processed data for a certain reason at a certain moment, and the data are reported to the cloud for subsequent analysis. For another example, if the average speed of the vehicle is higher than 120Km/h, the user wants to know the average speed of the vehicle in the past half hour, and reminds the driver through vehicle-mounted broadcasting, the user can set the rule at the cloud end of the internet of things and send the rule to the edge node, the edge node can calculate the obtained reported data of the vehicle in real time and match the rule, namely the rule is executed at the edge node, and when the average speed of the vehicle is higher than 120Km/h in the past half hour at a certain moment, the driver is reminded through vehicle-mounted broadcasting.
In some embodiments, after calculating the target data and matching the rule, the method further includes: if the matching rule is successful, executing corresponding action, wherein the action comprises at least one of the following actions: and informing a user, reporting the cloud end of the Internet of things, and controlling corresponding equipment to execute corresponding actions.
It should be noted that, if the matching rule is successful, the device corresponding to the corresponding device in the corresponding action executed by the control device may be the same device as the device for acquiring the reported data, may also be a plurality of devices including the device for acquiring the reported data, and may also be one or more devices unrelated to the device for reporting the data. The present invention is not limited to the embodiments. For example: the manager of the machine room is very aware of the temperature of the machine room, and wants to inform the temperature sensor in the machine room when the average temperature reported by the last 20 times exceeds 40 ℃. He may establish a rule that when the average of the last 20 times is greater than 40, the trigger action sends him a short message notification. After receiving the rule, the edge node establishes a memory data set in the memory for the rule and is responsible for executing the rule, when the reported temperature is received each time, the edge node stores the reported temperature in the corresponding memory data set after shunting, performs sliding window calculation on the memory data set in real time, judges whether the mean value meets the condition, and triggers an action if the mean value meets the condition, and sends a short message to an administrator.
The above event processing method is further described in detail by a specific embodiment.
S201: establishing a mapping relation between equipment and a rule and a mapping relation between the rule and a memory data set;
s202: acquiring reported data of equipment;
s203: if the format of the reported data is inconsistent with the preset format, converting the format of the reported data into the preset format;
s204: obtaining rules corresponding to equipment
S205: distributing the reported data according to rules;
s206: storing the reported data in a corresponding memory data set;
s207: acquiring target data from the memory data set;
s208: calculating target data by a sliding window and matching rules;
s209: releasing historical reported data which are stored in the memory data set and exceed the sliding window;
s210: and if the matching rule is successful, executing corresponding action.
It should be noted that the target data at least includes the report data, and the target data is data required by the matching rule.
It should be noted that the method can be applied to the cloud end and/or the edge node of the internet of things.
It should be noted that, in executing the corresponding action, the action includes, but is not limited to, notifying the user, reporting to the cloud of the internet of things, and controlling the corresponding device to execute the corresponding action.
The event processing method provided by the embodiment of the invention distributes the reported data according to the rules and stores the distributed reported data in the corresponding memory data set by acquiring the reported data of the equipment and the rules corresponding to the equipment, acquires target data from the memory data set, wherein the target data at least comprises the reported data, is data required by matching the rules, calculates the target data and matches the rules. The method solves the technical problems that no effective solution is available for the problem of the complex event rules, particularly the aggregation type rules, and the user experience is low in the prior art, achieves the effect of providing an effective solution for the problem of the complex event rules, particularly the aggregation type rules, and improves the technical effect of the user experience.
When the event processing method is used for the edge node, the edge node supports complex event rules, especially aggregation rules, the capability of a rule engine on the edge node can be greatly improved, meanwhile, the cloud Internet of things platform does not need to process a large number of complex events, and pressure is relieved. In addition, as the processing is closer to the source of data generation, the calculation is faster, and the speed of outputting the result is also faster relatively. Thirdly, the sliding window calculation based on the memory is adopted, and a large amount of CPU and memory are occupied as large data components such as Spark/Flink and the like are adopted in the prior art. The event processing method provided by the embodiment of the invention occupies less memory, so that the event processing method is suitable for being used in the scene of limited resources, namely the edge node. When the event processing method is used for the cloud of the internet of things, the event processing method needs to occupy a large amount of CPU and memory compared with the event processing method in the prior art which adopts large data components such as Spark/Flink and the like, and the memory occupation of the event processing method provided by the embodiment of the invention is relatively small, so that the resources are saved. Furthermore, in the embodiment of the present invention, since the historical reported data stored in the memory data set beyond the sliding window is released, the occupied memory is further reduced.
Example two:
the present embodiment further provides an event processing apparatus, as shown in fig. 3, the event processing apparatus 300 includes:
a first obtaining module 201, configured to obtain reported data of a device;
a second obtaining module 202, configured to obtain a rule corresponding to the device;
the distribution module 203 is used for distributing the reported data according to rules;
a memory data set 204 for storing corresponding reported data;
a third obtaining module 205, configured to obtain target data from the memory data set, where the target data at least includes reporting data, and the target data is data required by the matching rule;
and the calculation matching module 206 is used for calculating the target data and matching the rules.
In some embodiments, the event processing method is applied to the internet of things, where the reported data of the device may be obtained after a reported data obtaining instruction is directly sent to the device; or the device can report actively and directly receive the reported data of the device; or converting the data into the reported data of the equipment based on the instruction of the user.
In some embodiments, the event processing apparatus further includes a configuration module, configured to establish a mapping relationship between the device and the rule and a mapping relationship between the rule and the memory data set before acquiring the report data of the device, where the mapping relationship between the rule and the memory data set is one-to-one mapping. It should be noted that the mapping relationship between the devices and the rules may be in the form of one device mapping one rule, one device mapping multiple rules, multiple devices mapping one rule, and the like, and is not limited in the embodiment of the present invention. The mapping relation between the equipment and the rule can be matched with the rule through the identification information of the equipment, so that the subsequent matching with the corresponding rule can be realized through the identification information of the equipment. Wherein the identification information of the device may be a device serial number. The labeling mode of the identification information of the device may be set according to an industry rule or may be set by a user, but it should be noted that the identification information of the device is different among devices in one event processing process.
In some embodiments, the rules are configured on the cloud platform side.
In some embodiments, the rule corresponding to the obtaining device may be a rule corresponding to the matching by reporting device identification information included in the data. The equipment identification information may be an equipment serial number, such as an IMEI code of the handset, etc.
In some embodiments, when one device corresponds to a plurality of rules, the reporting data of the device is shunted by a corresponding amount according to the rules. For example, the device a corresponds to three rules a, b, and c, and the three rules a, b, and c respectively correspond to D, E, F memory data sets, and at this time, the reported data F of the device a is split three times according to the three rules a, b, and c, where the split is three same reported data F1, F2, and F3, and it is required to say that the three reported data F1, F2, F3 are consistent with the three reported data F. And correspondingly storing F1, F2 and F3 in D, E, F three memory data sets respectively.
It should be noted that, when the rule corresponding to the device is not obtained, that is, when the device does not have a matching rule before, the obtained reported data is directly released, and no subsequent processing is performed.
It should be noted that, in some embodiments, the memory data set is a rule-based granularity, and a logical partition is established in the memory for each rule to form the memory data set.
It should be noted that the target data at least includes the reported data, and the target data is data required by the matching rule.
In some embodiments, when the target data is more than the report data, the memory data set also stores historical report data; at this time, the target data includes report data and target history report data. It should be noted that the historical report data is report data acquired before the time point at which the current report data is acquired and/or report data acquired at the same time as the time point at which the current report data is acquired. The data source of the historical reported data may be the same device as the current device reporting the data, or may be derived from other devices different from the device reporting the data, but at least one common rule exists in the rules respectively corresponding to the other devices and the current device. For example, at time T1, device a reporting data a is acquired, at time T0, device c reporting data B, C and device d reporting data E are acquired, at time T0 is before time T1, at least one common rule exists among the rules corresponding to devices a, c and d, and B, C, E stored in the memory data set corresponding to the common rule is history reporting data.
In some embodiments, the computational matching module includes a sliding window.
In some embodiments, the historical reported data stored in the memory dataset may be subjected to an aging mechanism, and the event processing apparatus further includes a release module, configured to release the historical reported data stored in the memory dataset beyond the sliding window after the sliding window calculates the target data and matches the rule. It can be understood that the calculated sliding window will shift one grid when the next piece of reported data is acquired or received. For example, if the current rule is to calculate the average value of the last 20 times of data reported by the temperature sensor, the historical reported data stored in the memory data set may be 20 times, and the current reported data is added to the historical reported data for 21 times in total. According to the rule, the sliding window only needs 20 times of reported data including the current reported data, the earliest 21 st time of historical reported data is the historical reported data exceeding the sliding window, and at the moment, the 21 st time of historical reported data is released from the memory data set. For another example, if the current rule is to calculate the number of input words in the last 20 minutes, and the current time is 15 hours and 20 minutes, after the number of input words in 15 hours and 20 minutes is acquired as the report data, the data memory set corresponding to the rule actually includes the number of input words in 21 minutes from 14 hours and 59 minutes to 15 hours and 20 minutes, and since the condition of the rule is that the number of input words in the last 20 minutes needs to be calculated, it is obvious that the history report data in 14 hours and 59 minutes is not within the calculation range of the sliding window, at this time, the history report data before 15 hours can be released.
It should be noted that the time for releasing the historical reported data may be after the target data is calculated and matched with the rule in the sliding window, or may be when the uploaded data is saved, the earliest data is directly released according to the memory capacity. The method is similar to the principle that the storage of the image data by the memory card in the automobile data recorder is to cover the earliest data in real time.
In some embodiments, the event processing apparatus further includes a configuration module, configured to, before shunting the reported data according to the rule, convert the format of the reported data into the preset format and then shunt the reported data according to the rule, if the format of the reported data is inconsistent with the preset format.
It should be noted that the format of the reported data may be understood as the language type of the reported data, and may also be understood as the type of the transmission protocol of the reported data, and those skilled in the art may set the format according to their needs. For example, when the current device a and the current device B both have a mapping relationship with the rule a, and after the reported data C of the device a and the reported data D of the device B are obtained, if the reported data C is an MQTT protocol, the reported data D is an LORA protocol, and the preset format is the MQTT protocol, the protocol type of the reported data D is converted into the MQTT protocol, and then the reported data are shunted according to the rule.
In some embodiments, the event processing device further comprises at least one of: the internet of things comprises an internet of things cloud and edge nodes.
When the time processing method is applied to the edge node, it should be noted that the rule may be configured at the cloud of the internet of things and then issued to the edge node related to the rule for calculation. For example, in the car networking scenario, the vehicles are required to react to the data of each sensor in a very short time, and if the data are transmitted to the cloud for analysis and processing and then returned, serious traffic accidents may be caused. The vehicle enterprise can configure the internet of things rule at the cloud of the internet of things, if the distance sensor detects a certain distance from a barrier, the vehicle enterprise can trigger the active braking system to send to a processing system in a vehicle as an edge node, and the vehicle enterprise is responsible for receiving sensor data, processing the rule and triggering the rule action, and does not directly transmit the data to the cloud for processing. The method can trigger one-time active braking on the processed data for a certain reason at a certain moment, and the data are reported to the cloud for subsequent analysis. For another example, if the average speed of the vehicle is higher than 120Km/h, the user wants to know the average speed of the vehicle in the past half hour, and reminds the driver through vehicle-mounted broadcasting, the user can set the rule at the cloud end of the internet of things and send the rule to the edge node, the edge node can calculate the obtained reported data of the vehicle in real time and match the rule, namely the rule is executed at the edge node, and when the average speed of the vehicle is higher than 120Km/h in the past half hour at a certain moment, the driver is reminded through vehicle-mounted broadcasting.
In some embodiments, the event processing apparatus further includes an action processing module, configured to, after calculating the target data and matching the rule, if the rule is successfully matched, perform a corresponding action, where the action includes at least one of: and informing a user, reporting the cloud end of the Internet of things, and controlling corresponding equipment to execute corresponding actions.
It should be noted that, if the matching rule is successful, the device corresponding to the corresponding device in the corresponding action executed by the control device may be the same device as the device for acquiring the reported data, may also be a plurality of devices including the device for acquiring the reported data, and may also be one or more devices unrelated to the device for reporting the data. The present invention is not limited to the embodiments. For example: the manager of the machine room is very aware of the temperature of the machine room, and wants to inform the temperature sensor in the machine room when the average temperature reported by the last 20 times exceeds 40 ℃. He may establish a rule that when the average of the last 20 times is greater than 40, the trigger action sends him a short message notification. After receiving the rule, the edge node establishes a memory data set in the memory for the rule and is responsible for executing the rule, when the reported temperature is received each time, the edge node stores the reported temperature in the corresponding memory data set after shunting, performs sliding window calculation on the memory data set in real time, judges whether the mean value meets the condition, and if so, the edge node is responsible for triggering action by the action processing module and sends a short message to an administrator.
The event processing device according to the embodiment of the present invention will be further described in the following with a scenario in which the event processing device includes an edge node.
Fig. 4 is a networking diagram of the cloud and edge nodes of the internet of things, and as can be seen from fig. 4, the rules are configured in the cloud. The configuration module 401 includes: the rule configuration module 4011 is configured to establish a mapping relationship between the device and the rule and a mapping relationship between the rule and the memory data set; a rule management module 4012, configured to manage the rule; and the rule issuing module 4013 is configured to issue the rule to an edge node related to the rule for calculation. The networking in fig. 4 includes two edge nodes, and it should be noted that the number of edge nodes is not limited in the embodiment of the present invention. In the edge node a, the obtaining module 4015 including the second obtaining module first receives the rule, then parses and preprocesses the rule, and loads the rule into the memory data set. After the obtaining module 4015 including the first obtaining module receives the reported data of the device, the shunting module 4016 distributes the reported data to the memory data set corresponding to the rule, and after the third obtaining module obtains the target data in the memory data set, the calculation matching module 4017 is responsible for calculation and rule matching, and if matching is successful, the action processing module 4018 is responsible for subsequent processing. The same is true for the edge node B, where the obtaining module 4019 including the second obtaining module first receives the rule, then parses and preprocesses the rule, and loads the rule into the memory dataset. After the obtaining module 4019 including the first obtaining module receives the reported data of the device, the distribution module 4020 distributes the reported data to the memory data set corresponding to the rule, and after the third obtaining module obtains the target data in the memory data set, the calculation matching module 4021 is responsible for calculation and rule matching, and if matching is successful, the action processing module 4022 is responsible for subsequent processing.
Fig. 5 is a schematic diagram of an embodiment of the present invention when the event processing apparatus is an edge node, after the report data of the device a and the report data of the device B are converted into a preset format by a protocol conversion module 505 through Message Queue Telemetry Transport (MQTT), the report data are first distributed to memory data sets corresponding to rules corresponding to the device a and the device B by a distribution module 504, and a sliding window 502 performs rule calculation based on the past period of historical report data 503 and the report data stored in the memory data sets, determines whether to match the rules, and if matching is successful, performs rule action triggering. It should be noted that there may be only one device in fig. 5, or there may be multiple devices, and two devices in the figures are merely exemplary illustrations, and do not represent that only two devices are included in the embodiments of the present invention. It should be noted that the preset format may be any feasible format set by the user based on the prior art. It should be noted that the number of the rules in the embodiment of the present invention may be multiple or one, and the comparison is not limited. Referring to fig. 5, each rule corresponds to a memory data set. When the sliding window processes the target data, and when the target data includes the historical report data, it may be understood that the sliding window processes the report data and the target report data, that is, as shown in fig. 5, a part of data in the memory data set may be released in time for the data that the sliding window does not include or does not have a corresponding data, so as to reduce the memory usage.
The event processing device provided by the embodiment of the invention comprises a first acquisition module, a second acquisition module and a processing module, wherein the first acquisition module is used for acquiring the reported data of equipment; the second acquisition module is used for acquiring the rule corresponding to the equipment; the distribution module is used for distributing the reported data according to rules; the memory data set is used for storing corresponding reported data; the third acquisition module is used for acquiring target data from the memory data set, wherein the target data at least comprises reported data, and the target data is data required by the matching rule; and the calculation matching module is used for calculating the target data and matching the rules. Through the application of the event processing device, an effective solving device for the problem of complex event rules, particularly aggregation type rules, is provided, and the user experience is improved. In addition, when the event processing device comprises the edge nodes, the edge nodes support complex event rules, especially aggregation rules, the capability of a rule engine on the edge nodes can be greatly improved, meanwhile, the cloud Internet of things platform does not need to process a large number of complex events, and pressure is relieved. In addition, as the processing is closer to the source of data generation, the calculation is faster, and the speed of outputting the result is also faster relatively. Thirdly, the sliding window calculation based on the memory is adopted, and a large amount of CPU and memory are occupied as large data components such as Spark/Flink and the like are adopted in the prior art. The event processing device provided by the embodiment of the invention occupies less memory, so that the event processing device is suitable for being used in the scene of limited resources, namely an edge node. When the event processing device comprises the internet of things cloud, the processing method of the event processing device needs to occupy a large amount of CPU and memory compared with the processing method of the event processing device in the prior art which adopts large data components such as Spark/Flink and the like, and the memory occupation of the event processing device provided by the embodiment of the invention is relatively small, so that the resources are saved. Furthermore, in the embodiment of the present invention, due to the existence of the release module, reasonable resource release can be performed according to a certain requirement, so as to further reduce the occupied memory.
Example three:
the present embodiment further provides an event processing terminal, as shown in fig. 6, which includes a processor 601, a memory 603, and a communication bus 602, where:
the communication bus 602 is used for realizing connection communication between the processor 601 and the memory 603;
the processor 601 is configured to execute one or more computer programs stored in the memory 603 to implement at least one step of the event processing method in the embodiments described above.
Example four:
the present embodiments also provide a computer-readable storage medium including volatile or non-volatile, removable or non-removable media implemented in any method or technology for storage of information such as computer-readable instructions, data structures, computer program modules or other data. Computer-readable storage media include, but are not limited to, RAM (Random Access Memory), ROM (Read-Only Memory), EEPROM (Electrically Erasable Programmable Read-Only Memory), flash Memory or other Memory technology, CD-ROM (Compact disk Read-Only Memory), Digital Versatile Disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other medium which can be used to store the desired information and which can be accessed by a computer.
The computer-readable storage medium in the present embodiment may be used to store one or more computer programs, and the stored one or more computer programs may be executed by a processor to implement at least one step of the event processing method in the above embodiments.
The present embodiment also provides a computer program (or computer software), which can be distributed on a computer-readable medium and executed by a computing device to implement at least one step of the event processing method in the foregoing embodiments; and in some cases at least one of the steps shown or described may be performed in an order different than that described in the embodiments above.
It should be understood that in some cases, at least one of the steps shown or described may be performed in a different order than described in the embodiments above.
The present embodiments also provide a computer program product comprising a computer readable means on which a computer program as shown above is stored. The computer readable means in this embodiment may include a computer readable storage medium as shown above.
It will be apparent to those skilled in the art that all or some of the steps of the methods, systems, functional modules/units in the devices disclosed above may be implemented as software (which may be implemented in computer program code executable by a computing device), firmware, hardware, and suitable combinations thereof. In a hardware implementation, the division between functional modules/units mentioned in the above description does not necessarily correspond to the division of physical components; for example, one physical component may have multiple functions, or one function or step may be performed by several physical components in cooperation. Some or all of the physical components may be implemented as software executed by a processor, such as a central processing unit, digital signal processor, or microprocessor, or as hardware, or as an integrated circuit, such as an application specific integrated circuit.
In addition, communication media typically embodies computer readable instructions, data structures, computer program modules or other data in a modulated data signal such as a carrier wave or other transport mechanism and includes any information delivery media as known to one of ordinary skill in the art. Thus, the present invention is not limited to any specific combination of hardware and software.
The foregoing is a more detailed description of embodiments of the present invention, and the present invention is not to be considered limited to such descriptions. For those skilled in the art to which the invention pertains, several simple deductions or substitutions can be made without departing from the spirit of the invention, and all shall be considered as belonging to the protection scope of the invention.
Claims (18)
1. An event processing method, characterized in that the event processing method comprises:
acquiring reported data of equipment;
acquiring a rule corresponding to the equipment;
distributing the reported data according to the rule;
storing the reported data in a corresponding memory data set;
acquiring target data from the memory data set, wherein the target data at least comprises the reported data and is data required by matching the rule;
and calculating the target data and matching the rule.
2. The event processing method according to claim 1,
when the target data is more than the reported data, historical reported data is also stored in the memory data set;
at this time, the target data includes the report data and target historical report data.
3. The event processing method of claim 2, wherein said calculating the target data and matching the rule comprises:
and calculating the target data by a sliding window and matching the rule.
4. The event processing method of claim 3, wherein after the sliding window computes the target data and matches the rule, further comprising:
and releasing the historical reported data which is stored in the memory data set and exceeds the sliding window.
5. The event processing method according to any of claims 1 to 4, wherein before acquiring the report data of the device, the method further comprises:
and establishing a mapping relation between the equipment and the rule and a mapping relation between the rule and the memory data set, wherein the mapping relation between the rule and the memory data set is one-to-one mapping.
6. The event processing method according to any one of claims 1 to 4, wherein before shunting the reported data according to the rule, the method further includes:
and if the format of the reported data is inconsistent with a preset format, converting the format of the reported data into the preset format, and then distributing the reported data according to the rule.
7. Event handling method according to any of claims 1-4, wherein the event handling method is applied to at least one of: the internet of things comprises an internet of things cloud and edge nodes.
8. The event processing method according to any of claims 1-4, wherein after said calculating said target data and matching said rule, further comprising:
if the rule is matched successfully, executing corresponding action, wherein the action comprises at least one of the following actions:
and informing a user, reporting the cloud end of the Internet of things, and controlling corresponding equipment to execute corresponding actions.
9. An event processing apparatus, characterized in that the event processing apparatus comprises:
the first acquisition module is used for acquiring the reported data of the equipment;
the second acquisition module is used for acquiring the rule corresponding to the equipment;
the distribution module is used for distributing the reported data according to the rule;
the memory data set is used for storing corresponding reported data;
a third obtaining module, configured to obtain target data from the memory data set, where the target data at least includes the reported data, and the target data is data required to match the rule;
and the calculation matching module is used for calculating the target data and matching the rule.
10. Event processing apparatus according to claim 9,
when the target data is more than the reported data, historical reported data is also stored in the memory data set;
at this time, the target data includes the report data and target historical report data.
11. The event processing apparatus of claim 10, wherein the computational matching module comprises a sliding window.
12. The event processing apparatus according to claim 11, wherein the event processing apparatus further comprises:
and the releasing module is used for releasing the historical reported data which is stored in the memory data set and exceeds the sliding window after the sliding window calculates the target data and matches the rule.
13. The event processing apparatus according to any one of claims 9 to 12, wherein the event processing apparatus further comprises:
a configuration module, configured to establish a mapping relationship between the device and the rule and a mapping relationship between the rule and the memory data set before the first obtaining module obtains the reported data of the device, where the mapping relationship between the rule and the memory data set is one-to-one mapping.
14. The event processing apparatus according to any one of claims 9 to 12, wherein the event processing apparatus further comprises:
and the protocol conversion module is used for converting the format of the reported data into a preset format and then distributing the reported data according to the rule before the distribution module distributes the reported data according to the rule and if the format of the reported data is inconsistent with the preset format.
15. The event processing apparatus according to any one of claims 9 to 12, wherein the event processing apparatus further comprises at least one of: the internet of things comprises an internet of things cloud and edge nodes.
16. The event processing apparatus according to any one of claims 9 to 12, wherein the event processing apparatus further comprises:
an action processing module, configured to, if matching the rule is successful, execute a corresponding action, where the action includes at least one of:
and informing a user, reporting the cloud end of the Internet of things, and controlling corresponding equipment to execute corresponding actions.
17. An event processing terminal, characterized in that the event processing terminal comprises: a processor, a memory, and a communication bus;
the communication bus is used for realizing connection communication between the processor and the memory;
the processor is configured to execute one or more computer programs stored in the memory to implement the steps of the event processing method according to any one of claims 1 to 8.
18. A computer-readable storage medium, characterized in that the computer-readable storage medium stores one or more computer programs executable by one or more processors to implement the steps of the event processing method according to any one of claims 1 to 8.
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910907179.1A CN112631740A (en) | 2019-09-24 | 2019-09-24 | Event processing method and device, terminal and computer readable storage medium |
PCT/CN2020/112251 WO2021057387A1 (en) | 2019-09-24 | 2020-08-28 | Event processing method and apparatus, terminal and computer-readable storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910907179.1A CN112631740A (en) | 2019-09-24 | 2019-09-24 | Event processing method and device, terminal and computer readable storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN112631740A true CN112631740A (en) | 2021-04-09 |
Family
ID=75165588
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910907179.1A Pending CN112631740A (en) | 2019-09-24 | 2019-09-24 | Event processing method and device, terminal and computer readable storage medium |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN112631740A (en) |
WO (1) | WO2021057387A1 (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116048866A (en) * | 2023-03-07 | 2023-05-02 | 浙江鹏信信息科技股份有限公司 | Data fault detection method, system and medium based on real-time stream computing engine |
WO2024125288A1 (en) * | 2022-12-12 | 2024-06-20 | 天翼数字生活科技有限公司 | Data storage method and apparatus for monitoring devices, and storage medium and device |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113918361A (en) * | 2021-10-09 | 2022-01-11 | 天翼物联科技有限公司 | Terminal control method, device, equipment and medium based on Internet of things rule engine |
CN116502125B (en) * | 2023-04-28 | 2024-03-12 | 重庆赛力斯凤凰智创科技有限公司 | Vehicle event dividing method and device and vehicle networking server |
Family Cites Families (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8881173B2 (en) * | 2009-07-23 | 2014-11-04 | Nec Corporation | Event processing system, distribution controller, event processing method, distribution control method, and program storage medium |
US9736226B2 (en) * | 2012-10-23 | 2017-08-15 | Nec Corporation | Rule distribution server, event processing system and method, and program |
EP3127006B1 (en) * | 2014-03-31 | 2019-06-05 | Huawei Technologies Co. Ltd. | Event processing system |
CN105138385A (en) * | 2015-08-25 | 2015-12-09 | 北京邮电大学 | Complex event processing method for Internet of Things |
US11768823B2 (en) * | 2016-02-17 | 2023-09-26 | Verizon Patent And Licensing Inc. | Rules execution system for IoT devices |
US10990429B2 (en) * | 2018-03-12 | 2021-04-27 | Vmware, Inc. | Rule-based reallocation of hosted compute resources |
-
2019
- 2019-09-24 CN CN201910907179.1A patent/CN112631740A/en active Pending
-
2020
- 2020-08-28 WO PCT/CN2020/112251 patent/WO2021057387A1/en active Application Filing
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2024125288A1 (en) * | 2022-12-12 | 2024-06-20 | 天翼数字生活科技有限公司 | Data storage method and apparatus for monitoring devices, and storage medium and device |
CN116048866A (en) * | 2023-03-07 | 2023-05-02 | 浙江鹏信信息科技股份有限公司 | Data fault detection method, system and medium based on real-time stream computing engine |
CN116048866B (en) * | 2023-03-07 | 2023-06-09 | 浙江鹏信信息科技股份有限公司 | Data fault detection method, system and medium based on real-time stream computing engine |
Also Published As
Publication number | Publication date |
---|---|
WO2021057387A1 (en) | 2021-04-01 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN112631740A (en) | Event processing method and device, terminal and computer readable storage medium | |
EP4013007B1 (en) | Vehicle-road cooperation apparatus and method, electronic device and storage medium | |
CN108712309A (en) | A kind of micro services node means of defence under micro services framework and system | |
WO2019128028A1 (en) | Road traffic data recording method and vehicle-mounted device | |
CN111930598B (en) | Information processing method based on block chain and big data analysis and big data platform | |
CN113220715B (en) | Data processing method, system, computer and readable storage medium | |
CN106686129A (en) | Load balancing method and load balancing system | |
US20200004785A1 (en) | Automatic grouping based on user behavior | |
CN112751772A (en) | Data transmission method and system | |
CN113364682A (en) | Data transmission method and device, storage medium and electronic device | |
CN114915457A (en) | Message transmission method, dynamic encryption method, device, electronic equipment and medium | |
CN107819768B (en) | Method for server to actively disconnect illegal long connection, terminal equipment and storage medium | |
EP3993358A1 (en) | Bandwidth management method and apparatus, computer storage medium, and chip | |
US20140317181A1 (en) | Establishing dynamic connection | |
CN117354312A (en) | Access request processing method, device, system, computer equipment and storage medium | |
CN116319810A (en) | Flow control method, device, equipment, medium and product of distributed system | |
CN110198294B (en) | Security attack detection method and device | |
CN111327499A (en) | Method and device for sending message and automobile | |
CN114553778A (en) | Heartbeat control method and device, storage medium and electronic equipment | |
CN114501374A (en) | Dynamic service deployment method, system, device and storage medium for Internet of vehicles | |
CN114237914A (en) | Management scheduling system based on hybrid cloud | |
CN112118275A (en) | Overload processing method, Internet of things platform and computer readable storage medium | |
CN112749398B (en) | Data transmission channel control method and system | |
CN118264708A (en) | Service call chain tracking method and system, storage medium and electronic equipment | |
CN108009292B (en) | Big data collection method and system |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |