WO2021057387A1 - 一种事件处理方法、装置、终端及计算机可读存储介质 - Google Patents

一种事件处理方法、装置、终端及计算机可读存储介质 Download PDF

Info

Publication number
WO2021057387A1
WO2021057387A1 PCT/CN2020/112251 CN2020112251W WO2021057387A1 WO 2021057387 A1 WO2021057387 A1 WO 2021057387A1 CN 2020112251 W CN2020112251 W CN 2020112251W WO 2021057387 A1 WO2021057387 A1 WO 2021057387A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
rule
event processing
reported
memory
Prior art date
Application number
PCT/CN2020/112251
Other languages
English (en)
French (fr)
Inventor
杨荣康
李娜
贺晋宁
Original Assignee
中兴通讯股份有限公司
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by 中兴通讯股份有限公司 filed Critical 中兴通讯股份有限公司
Publication of WO2021057387A1 publication Critical patent/WO2021057387A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements 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/46Multiprogramming arrangements
    • G06F9/466Transaction processing
    • G06F9/467Transactional memory
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements 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/44Arrangements for executing specific programs
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements 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/46Multiprogramming arrangements
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/12Protocols specially adapted for proprietary or special-purpose networking environments, e.g. medical networks, sensor networks, networks in vehicles or remote metering networks

Definitions

  • the embodiments of the present application relate to but not limited to the fields of Internet of Things and edge computing, and specifically relate to but not limited to an event processing method, device, terminal, and computer-readable storage medium.
  • the Internet of Things is the Internet of Things, it is the extension of the Internet and the future development direction.
  • the hot Internet can be understood as the close connection of humans, and the Internet of Things connects humans and various things (ie devices).
  • the number of connections is at least an order of magnitude higher, and secondly, things are also connected.
  • the network the linkage of people and things, and things and things, will produce many valuable application scenarios.
  • an “event” refers to the occurrence of something.
  • an “event” refers to an object that points to computer processing, which marks or records an event that has occurred.
  • an event is the object of a certain activity record in the system.
  • An event marks an activity, and an event may be related to other events.
  • CEP Complex Event Processing
  • CEP Complex Event Processing
  • Edge computing technology as another key technology of the Internet of Things, is also a hot spot of current research.
  • cloud computing emerged, there was a view that the terminal only needs a display screen, and all the data of the Internet of Things is transmitted to the cloud center, and the cloud center completes the calculation process, and then transmits it back to the user's terminal. Therefore, thin terminals will be the future trend.
  • edge computing refers to an open platform that integrates core capabilities of network, computing, storage, and applications on the edge of the network close to the source of things or data, and provides edge intelligent services nearby.
  • An event processing method, device, terminal, and computer-readable storage medium provided by the embodiments of the present application.
  • An embodiment of the application provides an event processing method, including: obtaining reported data of a device; obtaining a rule corresponding to the device; splitting the reported data according to the rule; storing the reported data in a corresponding memory Data set; obtain target data from the memory data set, the target data includes at least the reported data, the target data is the data required to match the rule; the target data is calculated and the rule is matched .
  • An embodiment of the present application also provides an event processing device, including: a first acquisition module for acquiring reported data of a device; a second acquisition module for acquiring a rule corresponding to the device; and a shunting module for acquiring The rules divide the reported data; the memory data set is used to store the corresponding reported data; the third acquisition module is used to obtain target data from the memory data set, and the target data includes at least the reported data , The target data is data required to match the rule; a calculation matching module is used to calculate the target data and match the rule.
  • An embodiment of the present application also provides an event processing terminal, including: a processor, a memory, and a communication bus; the communication bus is used to realize the connection and communication between the processor and the memory; the processor is used to execute data stored in the memory
  • One or more computer programs to implement the steps of the event processing method as described in any one of the above.
  • the embodiments of the present application also provide a computer-readable storage medium, the computer-readable storage medium stores one or more computer programs, and the one or more computer programs can be executed by one or more processors to realize The steps of the event processing method as described in any one of the above.
  • FIG. 1 is a schematic flowchart of an event processing method provided in Embodiment 1 of this application;
  • FIG. 2 is a schematic flowchart of a specific embodiment of an event processing method provided in Embodiment 1 of this application;
  • FIG. 3 is a structural diagram of an event processing device provided in Embodiment 2 of this application.
  • FIG. 4 is a networking diagram of the event processing device IoT cloud and edge nodes provided by the second embodiment of the application;
  • FIG. 5 is a schematic diagram of the second embodiment of the application when the event processing device is an edge node
  • FIG. 6 is a schematic structural diagram of an event processing terminal provided in Embodiment 3 of this application.
  • an event processing method provided by an embodiment of the present application includes:
  • the event processing method is applied to the Internet of Things, in which the reported data of the device can be obtained by directly sending the report data acquisition instruction to the device, and the reported data of the obtained device can also be directly received by the device.
  • the reported data of the device it can also be converted into the reported data of the device based on the user's instruction.
  • the device before obtaining the reported data of the device, it further includes: establishing a mapping relationship between the device and the rule and the mapping relationship between the rule and the memory data set, where the mapping relationship between the rule and the memory data set is one One mapping.
  • the mapping relationship between devices and rules can be that one device maps one rule, one device maps multiple rules, or multiple devices map one rule. In the embodiment of this application, it is not Make a limit.
  • the mapping relationship between the device and the rule can be matched with the rule through the identification information of the device, so as to subsequently match the corresponding rule by identifying the identification information of the device.
  • the identification information of the device may be the serial number of the device.
  • the labeling method of the identification information of the device can be set according to industry rules or set by the user. However, it should be noted that in an event processing process, the device identification information of each device is different.
  • the aforementioned rules are configured on the cloud platform side.
  • obtaining the rule corresponding to the device may be to match the corresponding rule through the device identification information included in the reported data.
  • the device identification information may be the device serial number, such as the IMEI code of the mobile phone.
  • the reported data of the device is split by a corresponding amount.
  • device A corresponds to the three rules of A, B, and C
  • the three rules of A, B, and C correspond to the three memory data sets of D, E, and F respectively.
  • the reported data F of device A will be based on A, B
  • the three rules of 3 and C are divided into three times, and the divided flows are F1, F2, and F3 with the same reported data. What needs to be explained is that F1, F2, F3 and F are consistent. Save F1, F2, and F3 in the three memory data sets of D, E, and F respectively.
  • the memory data set uses rules as the granularity, and a logical partition is established in the memory for each rule to become a memory data set.
  • the target data includes at least the reported data, and the target data is the data required by the matching rule.
  • the historical reported data is also stored in the memory data set; at this time, the target data includes the reported data and the target historical reported data.
  • the historical report data is the report data acquired before the time point when the current report data is acquired and/or the report data acquired at the same time point when the current report data is acquired.
  • the data source of the historically reported data can be the same device as the current device that reports the data, or it can be from other devices that are different from the device that reports the data, but there is at least one common rule in the rules corresponding to the other devices and the current device. rule.
  • the reported data A of device A is obtained, the reported data B and C of device C, and the reported data E of device D are obtained at time T0.
  • Time T0 is before time T1, and the corresponding data of device A, C, and D are obtained.
  • calculating the target data and matching the rule includes: a sliding window calculating the target data and matching the rule.
  • the sliding window calculates the target data and matches the rules, it also includes:
  • the historically reported data is released. It can be understood that when the next report data is acquired or received, the sliding window of the calculation will shift by one grid.
  • the current rule is to calculate the average value of the data reported by the temperature sensor for the most recent 20 times.
  • the historical data reported in the memory data set may be 20 times, plus the current reported data, resulting in a total of 21 reported data.
  • the sliding window only needs 20 reported data including the current reported data, and the earliest 21st historical reported data is beyond the historical reported data included in the sliding window.
  • the 21st reported data The historically reported data will be released from the memory data set.
  • the current rule is to calculate the number of input words in the last 20 minutes, and the current time is 15:20.
  • the data memory set corresponding to the rule actually includes slaves.
  • a total of 21 minutes of input word data from 14:59 to 15:20. Since the rule requires calculating the number of input words in the last 20 minutes, it is obvious that the historical data reported at 14:59 is not within the calculation range of the sliding window. At this time, the historical data reported before 15:00 can be released.
  • timing of historical data release can be after the sliding window calculates the target data and matches the rules, or it can release the oldest data directly according to the memory capacity while saving the uploaded data.
  • This method is similar to the principle that the memory card in the driving recorder saves the image data by covering the earliest data in real time.
  • the method before splitting the reported data according to the rules, the method further includes:
  • the reported data is split according to the rules.
  • the format of the reported data can be understood as the language type of the reported data, and can also be understood as the transmission protocol type of the reported data, and those skilled in the art can set it according to their needs.
  • the current device A and device B both have a mapping relationship with Rule A.
  • the protocol type of the reported data D is converted to the MQTT protocol, and then the above-mentioned reported data is split according to the rules.
  • the above event processing method is applied to at least one of the following: IoT cloud, edge node.
  • the above rule may be configured in the IoT cloud and then issued to the edge node related to the rule for calculation.
  • the Internet of Vehicles scene requires vehicles to respond to the data of various sensors in a very short time. If the data is sent to the cloud for analysis and processing and then returned, it may cause serious traffic accidents.
  • Car companies can configure IoT rules in the IoT cloud. For example, when a distance sensor detects a certain distance from an obstacle, it can trigger an active braking system and send it to the processing system in the vehicle.
  • an edge node it is responsible for receiving sensor data and processing Rules, triggering rule actions without sending data directly to the cloud for processing.
  • the user wants to know the average speed of the vehicle in the past half hour. If the average speed is higher than 120Km/h, the driver will be reminded through the on-board broadcast. He can set the above rules in the IoT cloud and send it to the edge node. The reported data of the obtained vehicle will be calculated in real time and matched to the rule, that is, the rule is executed at the edge node. When the average speed of the vehicle in the past half an hour is higher than 120Km/h at a certain moment, the driver will be broadcast to the driver through the vehicle Make a reminder.
  • the target data and matching the rule after calculating the target data and matching the rule, it further includes: if the matching rule is successful, execute a corresponding action.
  • the action includes at least one of the following: informing the user, reporting to the IoT cloud, and controlling the corresponding The device executes the corresponding action.
  • the corresponding device in controlling the corresponding device to perform the corresponding action can be the same device as the device that obtains the reported data, or it can be many including the device that obtains the reported data.
  • the device may also be one or more devices that are not related to the device that reports the data. It is not limited in the embodiments of this application.
  • the computer room manager is very concerned about the temperature of the computer room. He hopes that the temperature sensor in the computer room can notify him when the average temperature reported by the temperature sensor in the computer room exceeds 40 degrees in the last 20 times. Then he can establish such a rule that when the average temperature of the last 20 times is greater than 40, the action is triggered to send him a text message notification.
  • the edge node After receiving this rule, the edge node establishes a memory data set in the memory for the rule, and is responsible for the execution of the rule. Each time it receives the reported temperature, it is saved in the corresponding memory data set after shunting, and in the memory in real time. The data set is calculated in a sliding window to determine whether the average value meets the conditions, and if it meets the conditions, the action is triggered and a message is sent to the administrator.
  • S201 Establish a mapping relationship between a device and a rule and a mapping relationship between a rule and a memory data set;
  • the sliding window calculates the target data and matches the rule
  • the target data includes at least the reported data, and the target data is the data required by the matching rule.
  • the actions include but are not limited to notifying the user, reporting to the IoT cloud, and controlling the corresponding device to perform the corresponding action.
  • the event processing method provided by the embodiments of the present application obtains the reported data of the device and the rules corresponding to the device, splits the reported data according to the rules and saves it in the corresponding memory data set, and obtains target data from the memory data set.
  • the target data includes at least Report data.
  • the target data is the data required to match the rules.
  • the target data is calculated and the rules are matched. It solves the technical problem that there is no effective solution to the complex event rules, especially the aggregation type rules in the current related technologies, and the technical problem of low user experience, and the problem of providing a complex event rule, especially the aggregation type rule. Effective solutions to improve the technical effects of user experience.
  • the edge nodes support complex event rules, especially aggregation rules, which can greatly improve the ability of the rule engine on the edge nodes.
  • the cloud IoT platform does not need to perform a large number of complex event processing, which reduces Pressure.
  • the processing is closer to the source of the data generation, the calculation is faster, and the speed of outputting the result is relatively faster.
  • the use of memory-based sliding window calculations like the use of large data components such as Spark/Flink (big data flow computing engine) in the existing related technologies, requires a large amount of CPU and memory.
  • the event processing method provided by the embodiments of the present application occupies less memory, and is therefore suitable for use in scenarios where resources are limited, such as edge nodes.
  • the event processing method When the event processing method is used in the cloud of the Internet of Things, since this event processing method requires a large amount of CPU and memory as compared with the existing related technologies that use big data components such as Spark/Flink, the event processing provided by the embodiment of the application The method's memory footprint is relatively small, saving resources. Furthermore, in the embodiment of the present application, since the historical report data stored in the memory data set beyond the sliding window is released, the occupied memory is further reduced.
  • the event processing device 300 includes:
  • the first obtaining module 201 is used to obtain reported data of the device
  • the second obtaining module 202 is used to obtain the rules corresponding to the device
  • the shunt module 203 is configured to shunt the reported data according to the rules
  • the memory data set 204 is used to store the corresponding reported data
  • the third acquisition module 205 is configured to acquire target data from a memory data set, the target data includes at least reported data, and the target data is data required for matching rules;
  • the calculation matching module 206 is used to calculate the target data and match the rules.
  • the event processing method is applied to the Internet of Things, in which the reported data of the device can be obtained by directly sending the report data acquisition instruction to the device, and the reported data of the obtained device can also be directly received by the device.
  • the reported data of the device it can also be converted into the reported data of the device based on the user's instruction.
  • the event processing apparatus further includes a configuration module, which is used to establish the mapping relationship between the device and the rule and the mapping relationship between the rule and the memory data set before obtaining the reported data of the device.
  • the mapping relationship between the data sets is a one-to-one mapping.
  • the mapping relationship between devices and rules can be that one device maps one rule, one device maps multiple rules, or multiple devices map one rule. In the embodiment of this application, it is not Make a limit.
  • the mapping relationship between the device and the rule can be matched with the rule through the identification information of the device, so as to subsequently match the corresponding rule by identifying the identification information of the device.
  • the identification information of the device may be the serial number of the device.
  • the labeling method of the identification information of the device can be set according to industry rules or set by the user. However, it should be noted that in an event processing process, the device identification information of each device is different.
  • the aforementioned rules are configured on the cloud platform side.
  • obtaining the rule corresponding to the device may be to match the corresponding rule through the device identification information included in the reported data.
  • the device identification information may be the device serial number, such as the IMEI code (International Mobile Equipment Identity) of the mobile phone.
  • the reported data of the device is split by a corresponding amount.
  • device A corresponds to the three rules of A, B, and C
  • the three rules of A, B, and C correspond to the three memory data sets of D, E, and F respectively.
  • the reported data F of device A will be based on A, B
  • the three rules of 3 and C are divided into three times, and the divided flows are F1, F2, and F3 with the same reported data. What needs to be explained is that F1, F2, F3 and F are consistent. Save F1, F2, and F3 in the three memory data sets of D, E, and F respectively.
  • the memory data set uses rules as the granularity, and a logical partition is established in the memory for each rule to become a memory data set.
  • the target data includes at least the reported data, and the target data is the data required by the matching rule.
  • the historical reported data is also stored in the memory data set; at this time, the target data includes the reported data and the target historical reported data.
  • the historical report data is the report data acquired before the time point when the current report data is acquired and/or the report data acquired at the same time point when the current report data is acquired.
  • the data source of the historically reported data can be the same device as the current device that reports the data, or it can be from other devices that are different from the device that reports the data, but there is at least one common rule in the rules corresponding to the other devices and the current device. rule.
  • the reported data A of device A is obtained, the reported data B and C of device C, and the reported data E of device D are obtained at time T0.
  • Time T0 is before time T1, and the corresponding data of device A, C, and D are obtained.
  • the calculation matching module includes a sliding window.
  • the event processing device further includes a release module for calculating the target data in a sliding window and matching the rules, and then checking the data stored in the memory data set. Release the historically reported data beyond the sliding window. It can be understood that when the next report data is acquired or received, the sliding window of the calculation will shift by one grid.
  • the current rule is to calculate the average value of the data reported by the temperature sensor for the most recent 20 times. At this time, the historical data reported in the memory data set may be 20 times, plus the current reported data, resulting in a total of 21 reported data.
  • the sliding window only needs 20 reported data including the current reported data, and the earliest 21st historical reported data is beyond the historical reported data included in the sliding window. At this time, the 21st reported data
  • the historically reported data will be released from the memory data set.
  • the current rule is to calculate the number of input words in the last 20 minutes, and the current time is 15:20. When the number of input words at 15:20 is obtained as the reported data, the data memory set corresponding to the rule actually includes slaves. A total of 21 minutes of input word data from 14:59 to 15:20. Since the rule requires calculating the number of input words in the last 20 minutes, it is obvious that the historical data reported at 14:59 is not within the calculation range of the sliding window. At this time, the historical data reported before 15:00 can be released.
  • timing of historical data release can be after the sliding window calculates the target data and matches the rules, or it can release the oldest data directly according to the memory capacity while saving the uploaded data.
  • This method is similar to the principle that the memory card in the driving recorder saves the image data and overwrites the earliest data in real time.
  • the event processing apparatus further includes a configuration module, which is used to convert the format of the reported data to the preset format if the format of the reported data is inconsistent with the preset format before splitting the reported data according to the rules , According to the rules, the reported data will be distributed.
  • a configuration module which is used to convert the format of the reported data to the preset format if the format of the reported data is inconsistent with the preset format before splitting the reported data according to the rules , According to the rules, the reported data will be distributed.
  • the format of the reported data can be understood as the language type of the reported data, and can also be understood as the transmission protocol type of the reported data, and those skilled in the art can set it according to their needs.
  • the current device A and device B both have a mapping relationship with Rule A.
  • the protocol type of the reported data D is converted to the MQTT protocol, and then the above-mentioned reported data is split according to the rules.
  • the above-mentioned event processing device further includes at least one of the following: IoT cloud, edge node.
  • the above rule may be configured in the IoT cloud and then issued to the edge node related to the rule for calculation.
  • the Internet of Vehicles scene requires vehicles to respond to the data of various sensors in a very short time. If the data is sent to the cloud for analysis and processing and then returned, it may cause serious traffic accidents.
  • Car companies can configure IoT rules in the IoT cloud. For example, when a distance sensor detects a certain distance from an obstacle, it can trigger an active braking system and send it to the processing system in the vehicle.
  • an edge node it is responsible for receiving sensor data and processing Rules, triggering rule actions without sending data directly to the cloud for processing.
  • the user wants to know the average speed of the vehicle in the past half hour. If the average speed is higher than 120Km/h, the driver will be reminded through the on-board broadcast. He can set the above rules in the IoT cloud and send it to the edge node. The reported data of the obtained vehicle will be calculated in real time and matched to the rule, that is, the rule is executed at the edge node. When the average speed of the vehicle in the past half an hour is higher than 120Km/h at a certain moment, the driver will be broadcast to the driver through the vehicle Make a reminder.
  • the event processing device further includes an action processing module, which is used to calculate the target data and match the rule, and if the matching rule is successful, execute a corresponding action.
  • the action includes at least one of the following: informing the user, Report to the IoT cloud and control the corresponding device to perform corresponding actions.
  • the corresponding device in controlling the corresponding device to perform the corresponding action can be the same device as the device that obtains the reported data, or it can be many including the device that obtains the reported data.
  • the device may also be one or more devices that are not related to the device that reports the data. It is not limited in the embodiments of this application.
  • the computer room manager is very concerned about the temperature of the computer room. He hopes that the temperature sensor in the computer room can notify him when the average temperature reported by the temperature sensor in the computer room exceeds 40 degrees in the last 20 times. Then he can establish such a rule that when the average temperature of the last 20 times is greater than 40, the action is triggered to send him a text message notification.
  • the edge node After receiving this rule, the edge node establishes a memory data set in the memory for the rule, and is responsible for the execution of the rule. Each time it receives the reported temperature, it is saved in the corresponding memory data set after shunting, and in the memory in real time. The data set is calculated in a sliding window to determine whether the average value meets the conditions. If it meets the conditions, the action processing module is responsible for triggering the action and sending a short message to the administrator.
  • the following describes the event processing device of the embodiment of the present application in a scenario where the above event processing device includes an edge node.
  • Figure 4 is a networking diagram of the IoT cloud and edge nodes. It can be seen from Figure 4 that the rules are configured in the cloud.
  • the configuration module 401 includes: a rule configuration module 4011, which is used to establish the mapping relationship between the device and the rule and the mapping relationship between the rule and the memory data set; the rule management module 4012, which is used to manage the above rules; the rule issuing module 4013, It is used to deliver the above rules to edge nodes related to the rules for calculation.
  • the networking of FIG. 4 includes two edge nodes. It should be noted that the number of edge nodes is not limited in the embodiment of the present application.
  • the acquisition module 4015 including the second acquisition module first receives the rules, then parses and preprocesses the rules, and loads the rules into the memory data set.
  • the acquisition module 4015 including the first acquisition module will distribute the reported data to the memory data set corresponding to the rule by the shunt module 4016 after receiving the reported data from the device.
  • the calculation matching module 4017 is responsible for calculation and rule matching. If the matching is successful, the action processing module 4018 is responsible for subsequent processing. The same is true for edge node B.
  • the acquisition module 4019 including the second acquisition module first receives the rules, then parses and preprocesses the rules, and loads the rules into the memory data set.
  • the acquisition module 4019 which includes the first acquisition module, receives the reported data from the device, and the shunt module 4020 distributes the reported data to the memory data set corresponding to the rule.
  • the calculation matching module 4021 is responsible for calculation and rule matching. If the matching is successful, the action processing module 4022 is responsible for subsequent processing.
  • Figure 5 is a schematic diagram when the event processing device is an edge node in an embodiment of the application.
  • Device A uses MQTT (Message Queuing Telemetry Transport) to report data and device B uses LORA (Long Range Radio, long distance) to report data.
  • MQTT Message Queuing Telemetry Transport
  • LORA Long Range Radio, long distance
  • the protocol conversion module 505 After the reported data of the radio) is converted into a preset format by the protocol conversion module 505, the shunt module 504 first distributes the reported data to the memory data sets corresponding to the rules corresponding to device A and device B.
  • the sliding window 502 is stored based on the memory data.
  • the historical reported data 503 and the reported data in the past period of time are calculated to determine whether the rule is matched, and if the matching is successful, the rule action is triggered. It should be noted that there may be only one device or multiple devices in FIG.
  • each rule corresponds to a memory data set.
  • the sliding window processes the target data
  • the target data includes the historical reported data
  • the sliding window processing includes the reported data and the target reported data, which is a part of the data in the memory data set as shown in Figure 5.
  • the window does not include or has no corresponding data, which can be released in time to reduce memory usage.
  • An event processing apparatus includes a first acquisition module for acquiring reported data of a device; a second acquisition module for acquiring rules corresponding to the device; and a shunting module for reporting data according to the rules Distribute; the memory data set is used to save the corresponding reported data; the third acquisition module is used to obtain the target data from the memory data set, the target data includes at least the reported data, and the target data is the data required by the matching rule; the calculation matching module , Used to calculate the target data and match the rules.
  • the edge nodes support complex event rules, especially aggregation rules, which can greatly improve the ability of the rule engine on the edge nodes.
  • the cloud IoT platform does not require a large amount of complex event processing. Reduced the pressure.
  • the processing is closer to the source of the data generation, the calculation is faster, and the speed of outputting the result is relatively faster.
  • the use of memory-based sliding window calculations like the use of large data components such as Spark/Flink in existing related technologies, requires a large amount of CPU and memory.
  • the event processing apparatus provided in the embodiments of the present application occupies less memory, and is therefore suitable for use in scenarios where resources are limited, such as edge nodes.
  • the processing method of the event processing device requires a large amount of CPU and memory as compared with the existing related technology using Spark/Flink and other big data components.
  • the memory occupancy of the event processing device is relatively small, saving resources. Further, in the embodiment of the present application, due to the existence of the release module, a reasonable resource release will be performed according to certain requirements to further reduce the occupied memory.
  • An embodiment of the present application also provides an event processing terminal. As shown in FIG. 6, it includes a processor 601, a memory 603, and a communication bus 602, where:
  • the communication bus 602 is used to implement connection and 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 in the event processing method in the foregoing embodiments.
  • the embodiments of the present application also provide a computer-readable storage medium, which is included in any method or technology for storing information (such as computer-readable instructions, data structures, computer program modules, or other data) Implementation of volatile or non-volatile, removable or non-removable media.
  • Computer readable storage media include but are not limited to RAM (Random Access Memory), ROM (Read-Only Memory, read-only memory), EEPROM (Electrically Erasable Programmable read only memory, charged Erasable Programmable Read-Only Memory) ), flash memory or other memory technology, CD-ROM (Compact Disc Read-Only Memory), digital versatile disk (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, magnetic disk storage or other magnetic storage devices, Or any other medium that can be used to store desired information and that can be accessed by a computer.
  • the computer-readable storage medium in the embodiments of the present application 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 of the event processing methods in the above embodiments step.
  • the embodiments of the present application also provide a computer program (or computer software).
  • the computer program can be distributed on a computer-readable medium and executed by a computable device to realize at least the event processing methods in the foregoing embodiments.
  • One step; and in some cases, at least one step shown or described can be performed in an order different from that described in the foregoing embodiment.
  • the embodiment of the present application also provides a computer program product, including a computer-readable device, and the computer-readable device stores the computer program as shown above.
  • the computer-readable device in the embodiment of the present application may include the computer-readable storage medium as shown above.
  • An event processing method, device, terminal, and computer-readable storage medium are provided in the embodiments of the present application.
  • the event processing method obtains the reported data of the device and the rules corresponding to the device, and divides the reported data according to the rules and saves it in the corresponding
  • the target data is obtained from the memory data set.
  • the target data includes at least the reported data.
  • the target data is the data required by the matching rule.
  • the target data is calculated and the rule is matched.
  • An effective solution to the problem of complex event rules, especially aggregation-type rules, is provided. The method is simpler, consumes less time, and improves user experience.
  • the functional modules/units in the system, and the device can be implemented as software (which can be implemented by computer program code executable by a computing device. ), firmware, hardware and their appropriate combination.
  • the division between functional modules/units mentioned in the above description does not necessarily correspond to the division of physical components; for example, a physical component may have multiple functions, or a function or step may consist of several physical components. The components are executed cooperatively.
  • Some physical components or all physical components can be implemented as software executed by a processor, such as a central processing unit, a digital signal processor, or a microprocessor, or as hardware, or as an integrated circuit, such as an application specific integrated circuit .
  • communication media usually contain computer-readable instructions, data structures, computer program modules, or other data in a modulated data signal such as carrier waves or other transmission mechanisms, and may include any information delivery medium. Therefore, this application is not limited to any specific combination of hardware and software.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Health & Medical Sciences (AREA)
  • Computing Systems (AREA)
  • General Health & Medical Sciences (AREA)
  • Medical Informatics (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

一种事件处理方法、装置、终端及计算机可读存储介质,该事件处理方法通过获取设备的上报数据(S101),获取设备所对应的规则(S102),根据规则将上报数据进行分流(S103),将上报数据保存在对应的内存数据集中(S104),从内存数据集中获取目标数据(S105),目标数据至少包括上报数据,目标数据为匹配规则所需的数据,对目标数据进行计算并匹配规则(S106)。

Description

一种事件处理方法、装置、终端及计算机可读存储介质
相关申请的交叉引用
本申请基于申请号为201910907179.1、申请日为2019年9月24日的中国专利申请提出,并要求该中国专利申请的优先权,该中国专利申请的全部内容在此以引入方式并入本申请。
技术领域
本申请实施例涉及但不限于物联网、边缘计算领域,具体而言,涉及但不限于一种事件处理方法、装置、终端及计算机可读存储介质。
背景技术
物联网即Internet of Things,它是互联网的延伸与未来的发展方向。当前,火热的互联网可以理解为将人类紧密的联结在一起,而物联网是将人类和各种物(即设备)联结在一起,首先联结数至少高了一个数量级,其次将物也接入了网络,人与物、物与物的联动,会产生很多有价值的应用场景。
什么是事件?在日常生活中,一个“事件”表示事情的发生,在CEP中,“事件”是一个指向计算机处理的对象,它标志或者记录某个发生的活动。简言之,事件是系统中某一活动记录的对象。事件标志着活动,一个事件可能和其他事件间存在关联。
复杂事件处理(CEP,Complex Event Processing)是一种基于动态环境中事件流的分析技术,事件在这里通常是有意义的状态变化,通过分析事件间的关系,利用过滤、关联、聚合等技术,根据事件间的时序关系和聚合关系制定检测规则,持续地从事件流中查询出符合要求的事件序列,最终分析得到更复杂的复合事件,主要用于网络诈欺识别等防止犯罪,银行等金融行业防止,以及 风险规避和营销决策等.
边缘计算技术作为物联网的另一个关键技术,也是当前研究的热点。在云计算兴起的时候,曾有观点认为,终端只要一个显示屏即可,物联网所有的数据都传输到云中心,由云中心完成运算过程,再传回到用户的终端。因此瘦终端将是未来的趋势。
但是,过度依赖云中心,会导致物联网的效率达不到预期,特别是对时延要求严格的场景,物联网部署变得毫无意义。比如车联网场景,需要车辆在极端时间内,对各个传感器的数据做出反应,如果把数据传到云端分析处理再返回,由于耗时原因,可能造成严重的交通事故。
业内对“边缘计算”定义是指,在靠近物或数据源头的网络边缘侧,融合网络、计算、存储、应用核心能力的开放平台,就近提供边缘智能服务。
目前,各大物联网平台都提供了边缘计算的功能,在边缘节点支持规则引擎的执行,但是支持的规则比较简单,对于复杂事件规则尤其是聚集类型的规则边缘节点不能支持执行。比如,用户需要计算平均温度超过20度且持续30分钟的事件,或者最近20次观测的最高湿度大于50%等这类复杂事件,业界各大物业网平台均没有提供有效的解决方法,现有的相关技术的方法较复杂,内存占用大,耗时长,用户体验低。
发明内容
本申请实施例提供的一种事件处理方法、装置、终端及计算机可读存储介质。
本申请实施例提供一种事件处理方法,包括:获取设备的上报数据;获取所述设备所对应的规则;根据所述规则将所述上报数据进行分流;将所述上报数据保存在对应的内存数据集中;从所述内存数据集中获取目标数据,所述目标数据至少包括所述上报数据,所述目标数据为匹配所述规则所需的数据;对所述目标数据进行计算并匹配所述规则。
本申请实施例还提供了一种事件处理装置,包括:第一获取模块,用于获 取设备的上报数据;第二获取模块,用于获取所述设备所对应的规则;分流模块,用于根据所述规则将所述上报数据进行分流;内存数据集,用于保存对应的上报数据;第三获取模块,用于从所述内存数据集中获取目标数据,所述目标数据至少包括所述上报数据,所述目标数据为匹配所述规则所需的数据;计算匹配模块,用于对所述目标数据进行计算并匹配所述规则。
本申请实施例还提供了一种事件处理终端,包括:处理器、存储器及通信总线;所述通信总线用于实现处理器和存储器之间的连接通信;所述处理器用于执行存储器中存储的一个或者多个计算机程序,以实现如上述任一项所述的事件处理方法的步骤。
本申请实施例还提供一种计算机可读存储介质,所述计算机可读存储介质存储有一个或者多个计算机程序,所述一个或者多个计算机程序可被一个或者多个处理器执行,以实现如上述任一项所述的事件处理方法的步骤。
本申请其他特征和相应的有益效果在说明书的后面部分进行阐述说明,且应当理解,至少部分有益效果从本申请说明书中的记载变的显而易见。
附图说明
图1为本申请实施例一提供的一种事件处理方法的流程示意图;
图2为本申请实施例一提供的一种事件处理方法具体实施例的流程示意图;
图3为本申请实施例二提供的事件处理装置的结构图;
图4为本申请实施例二提供的事件处理装置物联网云端与边缘节点的一种组网图;
图5为本申请实施例二中当事件处理装置为边缘节点时的一种原理图;
图6为本申请实施例三提供的事件处理终端的结构示意图。
具体实施方式
为了使本申请的目的、技术方案及优点更加清楚明白,下面通过具体实施方式结合附图对本申请实施例作进一步详细说明。应当理解,此处所描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。
实施例一:
请参见图1,本申请实施例提供的一种事件处理方法包括:
S101:获取设备的上报数据;
S102:获取设备所对应的规则;
S103:根据规则将上报数据进行分流;
S104:将上报数据保存在对应的内存数据集中;
S105:从内存数据集中获取目标数据;
S106:对目标数据进行计算并匹配规则。
在一些实施例中,事件处理方法应用于物联网,其中获取设备的上报数据可以是直接向设备发出上报数据获取指令后,获取到的设备的上报数据;也可以是设备主动上报的,直接接收设备的上报数据;还可以是基于用户的指令,转换为设备的上报数据。
在一些实施例中,获取设备的上报数据之前,还包括:建立设备与规则之间的映射关系以及规则与内存数据集之间的映射关系,其中规则与内存数据集之间的映射关系为一一映射。需要说明的是,设备与规则之间的映射关系可以是一个设备映射一个规则,也可以是一个设备映射多个规则,还可以是多个设备映射一个规则等形式,在本申请实施例中不做限定。设备与规则之间的映射关系可以通过设备的识别信息来与规则进行匹配,以便后续通过识别设备的识别信息来与其所对应的规则进行匹配。其中设备的识别信息可以是设备序列号。设备的识别信息的标注方式可以是根据行业规则进行设置,也可以是用户自行设定,但需要说明的是,在一个事件处理过程中,各设备之间的设备识别信息是各不相同的。
在一些实施例中,上述规则是在云端平台侧配置的。
在一些实施例中,获取设备所对应的规则可以是通过上报数据中包括的设备识别信息来匹配相应的规则。设备识别信息可以是设备序列号,例如手机的IMEI码等。
在一些实施例中,当一个设备对应多个规则时,根据规则将上报数据进行分流时,将该设备的上报数据进行相应数量的分流。例如,设备A对应甲、乙、丙三个规则,甲、乙、丙三个规则分别对应D、E、F三个内存数据集,此时,设备A的上报数据F,将根据甲、乙、丙三个规则进行三次分流,分流为F1、F2、F3三个相同的上报数据,需要说明的是F1、F2、F3与F之间一致。分别将F1、F2、F3对应保存在D、E、F三个内存数据集中。
需要说明的是,当获取不到设备所对应的规则时,也即设备之前没有匹配规则时,此时对于获取到的上报数据直接进行释放,不再进行后续处理。
需要说明的是,在一些实施例中,内存数据集是以规则为粒度,为每个规则在内存中建立逻辑上的分区,成为内存数据集。
需要说明的是,目标数据中至少包括上报数据,目标数据为匹配规则所需的数据。
在一些实施例中,当目标数据多于上报数据时,内存数据集中还保存有历史上报数据;此时,目标数据包括上报数据和目标历史上报数据。需要说明的是,历史上报数据为在当前上报数据获取到的时间点之前所获取到的上报数据和/或当前上报获取到的时间点的同时所获取到的上报数据。该历史上报数据的数据来源可以是与上报数据的当前设备为同一个设备,也可以来源于与上报数据的设备不同的其他设备,但其他设备与当前设备分别所对应的规则中存在至少一个共同规则。例如,T1时刻,获取到设备甲上报数据A,T0时刻获取到设备丙的上报数据B、C、设备丁的上报数据E,T0时刻在T1时刻之前,且设备甲、丙、丁所对应的规则中至少存在一个共同规则,在共同规则所对应的内存数据集中所保存的B、C、E为历史上报数据。
在一些实施例中,对目标数据进行计算并匹配规则包括:滑动窗口对目标数据进行计算并匹配规则。
在一些实施例中,对于保存在内存数据集中的历史上报数据会有老化机制,也即滑动窗口对目标数据进行计算并匹配规则之后,还包括:对保存在内存数据集中超出滑动窗口所包括的历史上报数据进行释放。可以理解,在获取到或者收到下一条上报数据时,计算的滑动窗口会平移一格。例如,当前规则是计算温度传感器最近20次上报数据的均值,则此时保存在内存数据集中的历史上报数据可能是有20次,加上当前的上报数据,一共21次上报数据。由于根据规则,滑动窗口只需要包括当前的上报数据在内的20次上报数据,则最早的第21次历史上报数据就为超出滑动窗口所包括的历史上报数据,此时,对该第21次历史上报数据将从内存数据集中进行释放。又例如,当前规则是计算最近20分钟内的输入字数,当前时间为15时20分,则当获取到15时20分的输入字数作为上报数据后,该规则对应的数据内存集中实际包括了从14时59分到15时20分一共21分钟的输入字数数据,由于规则的条件是需要计算最近20分钟内的输入字数,显然在14时59分的历史上报数据就不在滑动窗口的计算范围之内了,此时,可以将15时之前的历史上报数据进行释放。
需要说明的是,历史上报数据释放的时机可以是在滑动窗口对目标数据进行计算并匹配规则之后,也可以是在保存上传数据的同时,直接根据内存容量将最早的数据进行释放。该方式类似于行车记录仪中存储卡对图像数据的保存是实时将最早的数据覆盖的原理相似。
在一些实施例中,根据规则将上报数据进行分流之前,还包括:
若上报数据的格式与预设格式不一致,则将上报数据的格式转换为预设格式后,根据规则将上报数据进行分流。
需要说明的是,上报数据的格式可以理解为上报数据的语言种类,也可以理解为上报数据的传输协议类型,本领域的技术人员可以根据其需要进行设置。例如,当前设备A和设备B都存在与规则甲的映射关系,获取到设备A的上报数据C和设备B的上报数据D后,若上报数据C是MQTT协议,上报数据D是LORA协议,预设格式是MQTT协议,此时将上报数据D的协议类型转换为MQTT协议后,再对上述各上报数据根据规则进行分流。
在一些实施例中,上述事件处理方法应用于以下至少之一:物联网云端、 边缘节点。
当上述时间处理方法应用于边缘节点时,需要说明的是上述规则可以是在物联网云端进行配置后,再下发到与该规则相关的边缘节点进行计算。例如,车联网场景,需要车辆在极短时间内,对各个传感器的数据做出反应,如果把数据传到云端分析处理再返回,可能造成严重的交通事故。车企可以在物联网云端配置物联网规则,如距离传感器检测到距离障碍物一定距离时,可以触发主动刹车系统,下发到车辆中的处理系统,作为边缘节点,它负责接收传感器数据,处理规则,触发规则动作,而不会将数据直接传到云端处理。它可以将处理后的数据,如某个时刻,由于某个原因触发了一次主动刹车,这样的数据上报到云端做后续分析。再比如,用户想了解过去半小时内车辆的平均速度,如果均速高于120Km/h则通过车载广播对司机进行提醒,他可以在物联网云端设置上述规则,下发到边缘节点,边缘节点会将获取到的车辆的上报数据实时计算并匹配规则,也就是规则的执行是在边缘节点,当匹配到某一时刻过去半小时内车辆的平均速度高于120Km/h则通过车载广播对司机进行提醒。
在一些实施例中,对目标数据进行计算并匹配规则之后,还包括:若匹配规则成功,则执行相应的动作,所述动作包括以下至少之一:通知用户、上报物联网云端、控制对应的设备执行相应的动作。
需要说明的是,若匹配规则成功,则控制对应的设备执行相应的动作中对应的设备可以是与获取上报数据的设备是同一个设备,也可以是包括获取上报数据的设备在内的很多个设备,还可以是与上报数据的设备无关的一个或者多个设备。在本申请实施例中不做限定。例如:机房管理员很在意机房的温度,他希望在机房里的温度传感器最近20次上报的平均温度超出40度时,能够通知他。那么他可以建立这样的一条规则,最近20次的温度均值大于40时,触发动作向他发送一条短信通知。边缘节点接收到这条规则后,为该规则在内存中建立内存数据集,并负责规则的执行,每次收到上报的温度时,通过分流后保存在相应的内存数据集,实时地在内存数据集做滑动窗口计算,判断均值是否满足条件,如果满足则触发动作,发送短信给管理员。
下面通过一种具体的实施例对上述事件处理方法进行进一步详细的说明。
S201:建立设备与规则之间的映射关系以及规则与内存数据集之间的映射关系;
S202:获取设备的上报数据;
S203:若上报数据的格式与预设格式不一致,则将上报数据的格式转换为预设格式;
S204:获取设备所对应的规则
S205:根据规则将上报数据进行分流;
S206:将上报数据保存在对应的内存数据集中;
S207:从内存数据集中获取目标数据;
S208:滑动窗口对目标数据进行计算并匹配规则;
S209:对保存在内存数据集中超出滑动窗口所包括的历史上报数据进行释放;
S210:若匹配规则成功,则执行相应的动作。
需要说明的是,目标数据至少包括上报数据,目标数据为匹配规则所需的数据。
需要说明的是,上述方法可以应用于物联网云端和/或边缘节点。
需要说明的是,执行相应的动作中,动作包括但不限于通知用户、上报物联网云端、控制对应的设备执行相应的动作。
本申请实施例提供的事件处理方法通过获取设备的上报数据及设备所对应的规则,根据规则将上报数据进行分流并保存在对应的内存数据集中,从内存数据集中获取目标数据,目标数据至少包括上报数据,目标数据为匹配规则所需的数据,对目标数据进行计算并匹配规则。解决了当前相关技术中对于复杂事件规则尤其是聚集类型的规则的问题没有有效的解决方法,用户体验度低的技术问题,达到了提供了一种对于复杂事件规则尤其是聚集类型的规则的问题的有效解决方法,提升用户体验度的技术效果。
当事件处理方法用于边缘节点时,边缘节点支持复杂事件规则,尤其是聚集类的规则,可以大大提升边缘节点上规则引擎的能力,同时云端物联网平台不需要进行大量的复杂事件处理,减轻了压力。此外,由于处理更加接近数据产生的源头,计算更快,输出结果的速度也相对更快。再次,采用基于内存的滑动窗口计算,与现有的相关技术中采用Spark/Flink(大数据流计算引擎)等大数据组件一样,需要占用大量CPU和内存。本申请实施例所提供的事件处理方法占用较少内存,因此适合在边缘节点这种资源受限的场景下使用。当事件处理方法用于物联网云端时,由于本事件处理方法相对于现有的相关技术中采用Spark/Flink等大数据组件一样,需要占用大量CPU和内存,本申请实施例所提供的事件处理方法的内存占用相对较小,节约资源。进一步的,本申请实施例中,由于对保存在内存数据集中超出滑动窗口所包括的历史上报数据进行释放,进一步减少占用的内存。
实施例二:
本申请实施例还提供了一种事件处理装置,如图3所示,事件处理装置300其包括:
第一获取模块201,用于获取设备的上报数据;
第二获取模块202,用于获取设备所对应的规则;
分流模块203,用于根据规则将上报数据进行分流;
内存数据集204,用于保存对应的上报数据;
第三获取模块205,用于从内存数据集中获取目标数据,目标数据至少包括上报数据,目标数据为匹配规则所需的数据;
计算匹配模块206,用于对目标数据进行计算并匹配规则。
在一些实施例中,事件处理方法应用于物联网,其中获取设备的上报数据可以是直接向设备发出上报数据获取指令后,获取到的设备的上报数据;也可以是设备主动上报的,直接接收设备的上报数据;还可以是基于用户的指令,转 换为设备的上报数据。
在一些实施例中,事件处理装置还包括,配置模块,用于在获取设备的上报数据之前,建立设备与规则之间的映射关系以及规则与内存数据集之间的映射关系,其中规则与内存数据集之间的映射关系为一一映射。需要说明的是,设备与规则之间的映射关系可以是一个设备映射一个规则,也可以是一个设备映射多个规则,还可以是多个设备映射一个规则等形式,在本申请实施例中不做限定。设备与规则之间的映射关系可以通过设备的识别信息来与规则进行匹配,以便后续通过识别设备的识别信息来与其所对应的规则进行匹配。其中设备的识别信息可以是设备序列号。设备的识别信息的标注方式可以是根据行业规则进行设置,也可以是用户自行设定,但需要说明的是,在一个事件处理过程中,各设备之间的设备识别信息是各不相同的。
在一些实施例中,上述规则是在云端平台侧配置的。
在一些实施例中,获取设备所对应的规则可以是通过上报数据中包括的设备识别信息来匹配相应的规则。设备识别信息可以是设备序列号,例如手机的IMEI码(国际移动设备识别码,International Mobile Equipment Identity)等。
在一些实施例中,当一个设备对应多个规则时,根据规则将上报数据进行分流时,将该设备的上报数据进行相应数量的分流。例如,设备A对应甲、乙、丙三个规则,甲、乙、丙三个规则分别对应D、E、F三个内存数据集,此时,设备A的上报数据F,将根据甲、乙、丙三个规则进行三次分流,分流为F1、F2、F3三个相同的上报数据,需要说明的是F1、F2、F3与F之间一致。分别将F1、F2、F3对应保存在D、E、F三个内存数据集中。
需要说明的是,当获取不到设备所对应的规则时,也即设备之前没有匹配规则时,此时对于获取到的上报数据直接进行释放,不再进行后续处理。
需要说明的是,在一些实施例中,内存数据集是以规则为粒度,为每个规则在内存中建立逻辑上的分区,成为内存数据集。
需要说明的是,目标数据中至少包括上报数据,目标数据为匹配规则所需的数据。
在一些实施例中,当目标数据多于上报数据时,内存数据集中还保存有历史上报数据;此时,目标数据包括上报数据和目标历史上报数据。需要说明的是,历史上报数据为在当前上报数据获取到的时间点之前所获取到的上报数据和/或当前上报获取到的时间点的同时所获取到的上报数据。该历史上报数据的数据来源可以是与上报数据的当前设备为同一个设备,也可以来源于与上报数据的设备不同的其他设备,但其他设备与当前设备分别所对应的规则中存在至少一个共同规则。例如,T1时刻,获取到设备甲上报数据A,T0时刻获取到设备丙的上报数据B、C、设备丁的上报数据E,T0时刻在T1时刻之前,且设备甲、丙、丁所对应的规则中至少存在一个共同规则,在共同规则所对应的内存数据集中所保存的B、C、E为历史上报数据。
在一些实施例中,计算匹配模块包括滑动窗口。
在一些实施例中,对于保存在内存数据集中的历史上报数据会有老化机制,事件处理装置还包括,释放模块,用于滑动窗口对目标数据进行计算并匹配规则之后,对保存在内存数据集中超出滑动窗口所包括的历史上报数据进行释放。可以理解,在获取到或者收到下一条上报数据时,计算的滑动窗口会平移一格。例如,当前规则是计算温度传感器最近20次上报数据的均值,则此时保存在内存数据集中的历史上报数据可能是有20次,加上当前的上报数据,一共21次上报数据。由于根据规则,滑动窗口只需要包括当前的上报数据在内的20次上报数据,则最早的第21次历史上报数据就为超出滑动窗口所包括的历史上报数据,此时,对该第21次历史上报数据将从内存数据集中进行释放。又例如,当前规则是计算最近20分钟内的输入字数,当前时间为15时20分,则当获取到15时20分的输入字数作为上报数据后,该规则对应的数据内存集中实际包括了从14时59分到15时20分一共21分钟的输入字数数据,由于规则的条件是需要计算最近20分钟内的输入字数,显然在14时59分的历史上报数据就不在滑动窗口的计算范围之内了,此时,可以将15时之前的历史上报数据进行释放。
需要说明的是,历史上报数据释放的时机可以是在滑动窗口对目标数据进行计算并匹配规则之后,也可以是在保存上传数据的同时,直接根据内存容量将最早的数据进行释放。该方式类似于行车记录仪中存储卡对图像数据的保存 是实时将最早的数据覆盖的原理相似。
在一些实施例中,事件处理装置还包括,配置模块,用于在根据规则将上报数据进行分流之前,若上报数据的格式与预设格式不一致,则将上报数据的格式转换为预设格式后,根据规则将上报数据进行分流。
需要说明的是,上报数据的格式可以理解为上报数据的语言种类,也可以理解为上报数据的传输协议类型,本领域的技术人员可以根据其需要进行设置。例如,当前设备A和设备B都存在与规则甲的映射关系,获取到设备A的上报数据C和设备B的上报数据D后,若上报数据C是MQTT协议,上报数据D是LORA协议,预设格式是MQTT协议,此时将上报数据D的协议类型转换为MQTT协议后,再对上述各上报数据根据规则进行分流。
在一些实施例中,上述事件处理装置还包括以下至少之一:物联网云端、边缘节点。
当上述时间处理方法应用于边缘节点时,需要说明的是上述规则可以是在物联网云端进行配置后,再下发到与该规则相关的边缘节点进行计算。例如,车联网场景,需要车辆在极短时间内,对各个传感器的数据做出反应,如果把数据传到云端分析处理再返回,可能造成严重的交通事故。车企可以在物联网云端配置物联网规则,如距离传感器检测到距离障碍物一定距离时,可以触发主动刹车系统,下发到车辆中的处理系统,作为边缘节点,它负责接收传感器数据,处理规则,触发规则动作,而不会将数据直接传到云端处理。它可以将处理后的数据,如某个时刻,由于某个原因触发了一次主动刹车,这样的数据上报到云端做后续分析。再比如,用户想了解过去半小时内车辆的平均速度,如果均速高于120Km/h则通过车载广播对司机进行提醒,他可以在物联网云端设置上述规则,下发到边缘节点,边缘节点会将获取到的车辆的上报数据实时计算并匹配规则,也就是规则的执行是在边缘节点,当匹配到某一时刻过去半小时内车辆的平均速度高于120Km/h则通过车载广播对司机进行提醒。
在一些实施例中,事件处理装置还包括动作处理模块,用于对目标数据进行计算并匹配规则之后,若匹配规则成功,则执行相应的动作,所述动作包括 以下至少之一:通知用户、上报物联网云端、控制对应的设备执行相应的动作。
需要说明的是,若匹配规则成功,则控制对应的设备执行相应的动作中对应的设备可以是与获取上报数据的设备是同一个设备,也可以是包括获取上报数据的设备在内的很多个设备,还可以是与上报数据的设备无关的一个或者多个设备。在本申请实施例中不做限定。例如:机房管理员很在意机房的温度,他希望在机房里的温度传感器最近20次上报的平均温度超出40度时,能够通知他。那么他可以建立这样的一条规则,最近20次的温度均值大于40时,触发动作向他发送一条短信通知。边缘节点接收到这条规则后,为该规则在内存中建立内存数据集,并负责规则的执行,每次收到上报的温度时,通过分流后保存在相应的内存数据集,实时地在内存数据集做滑动窗口计算,判断均值是否满足条件,如果满足则由动作处理模块负责触发动作,发送短信给管理员。
下面以上述事件处理装置包括边缘节点的场景,对本申请实施例的事件处理装置做进行一步说明。
图4为物联网云端与边缘节点的组网图,由图4可知,规则是在云端配置的。配置模块401包括:规则配置模块4011,用于建立设备与规则之间的映射关系以及规则与内存数据集之间的映射关系;规则管理模块4012,用于管理上述规则;规则下发模块4013,用于将上述规则下发到规则相关的边缘节点进行计算。图4的组网中,包括两个边缘节点,需要说明的是,边缘节点的数量在本申请实施例中并不做限定。在边缘节点A中,包括第二获取模块的获取模块4015首先接收到规则,然后解析并预处理规则,把规则加载到内存数据集中。包括第一获取模块的获取模块4015当接收到设备的上报数据后,由分流模块4016把上报数据分发到规则对应的内存数据集上,第三获取模块获取到内存数据集中的目标数据后,由计算匹配模块4017负责计算和规则匹配,如果匹配成功,则由动作处理模块4018负责后续处理。对于边缘节点B来说,也是一样的,包括第二获取模块的获取模块4019首先接收到规则,然后解析并预处理规则,把规则加载到内存数据集中。包括第一获取模块的获取模块4019当接收到设备的上报数据后,由分流模块4020把上报数据分发到规则对应的内存数据集上,第三获取模块获取到内存数据集中的目标数据后,由计算匹配模块4021负责计 算和规则匹配,如果匹配成功,则由动作处理模块4022负责后续处理。
图5为本申请实施例中当事件处理装置为边缘节点时的原理图,设备A以MQTT(Message Queuing Telemetry Transport,消息队列遥测传输)的上报数据和设备B以LORA(Long Range Radio,远距离无线电)的上报数据经过协议转换模块505转换为预设的格式后,首先由分流模块504将上报数据分发到设备A和设备B对应的规则对应的内存数据集,滑动窗口502基于内存数据集中保存的过去一段时间的历史上报数据503和上报数据进行规则的计算,判断是否匹配上规则,如果匹配成功,进行规则动作的触发。需要说明的是,图5中的设备可以只有一个,也可以具有多个,图中的两个设备仅是示例性的说明,并不代表本申请实施例中仅包括两个设备。需要说明的是,预设格式可以是用户基于现有技术设置的任意可行的格式。需要说明的是,本申请实施例中的规则的数量可以是多个,也可以是一个,对比不做限定。参见图5,每一个规则对应一个内存数据集。滑动窗口在对目标数据进行处理时,当目标数据包括历史上报数据时,可以理解为滑动窗口处理包括上报数据和目标上报数据,也就如图5所示的内存数据集中的一部分数据,对于滑动窗口所没有包括或者说没有对应的数据,可以及时释放,以减少内存占用。
本申请实施例提供的一种事件处理装置,包括第一获取模块,用于获取设备的上报数据;第二获取模块,用于获取设备所对应的规则;分流模块,用于根据规则将上报数据进行分流;内存数据集,用于保存对应的上报数据;第三获取模块,用于从内存数据集中获取目标数据,目标数据至少包括上报数据,目标数据为匹配规则所需的数据;计算匹配模块,用于对目标数据进行计算并匹配规则。通过上述事件处理装置的应用,提供了一种对于复杂事件规则尤其是聚集类型的规则的问题的有效解决装置,提升用户体验度。另外,当事件处理装置包括边缘节点时,边缘节点支持复杂事件规则,尤其是聚集类的规则,可以大大提升边缘节点上规则引擎的能力,同时云端物联网平台不需要进行大量的复杂事件处理,减轻了压力。此外,由于处理更加接近数据产生的源头,计算更快,输出结果的速度也相对更快。再次,采用基于内存的滑动窗口计算,与现有的相关技术中采用Spark/Flink等大数据组件一样,需要占用大量CPU和 内存。本申请实施例所提供的事件处理装置占用较少内存,因此适合在边缘节点这种资源受限的场景下使用。当事件处理装置包括物联网云端时,由于本事件处理装置的处理方法相对于现有的相关技术中采用Spark/Flink等大数据组件一样,需要占用大量CPU和内存,本申请实施例所提供的事件处理装置的内存占用相对较小,节约资源。进一步的,本申请实施例中,由于释放模块的存在,会按照一定的要求进行合理的资源释放,进一步减少占用的内存。
实施例三:
本申请实施例还提供了一种事件处理终端,参见图6所示,其包括处理器601、存储器603及通信总线602,其中:
通信总线602用于实现处理器601和存储器603之间的连接通信;
处理器601用于执行存储器603中存储的一个或者多个计算机程序,以实现上述各实施例中的事件处理方法中的至少一个步骤。
实施例四:
本申请实施例还提供了一种计算机可读存储介质,该计算机可读存储介质包括在用于存储信息(诸如计算机可读指令、数据结构、计算机程序模块或其他数据)的任何方法或技术中实施的易失性或非易失性、可移除或不可移除的介质。计算机可读存储介质包括但不限于RAM(Random Access Memory,随机存取存储器),ROM(Read-Only Memory,只读存储器),EEPROM(Electrically Erasable Programmable read only memory,带电可擦可编程只读存储器)、闪存或其他存储器技术、CD-ROM(Compact Disc Read-Only Memory,光盘只读存储器),数字多功能盘(DVD)或其他光盘存储、磁盒、磁带、磁盘存储或其他磁存储装置、或者可以用于存储期望的信息并且可以被计算机访问的任何其他的介质。
本申请实施例中的计算机可读存储介质可用于存储一个或者多个计算机程序,其存储的一个或者多个计算机程序可被处理器执行,以实现上述各实施例中的事件处理方法的至少一个步骤。
本申请实施例还提供了一种计算机程序(或称计算机软件),该计算机程序可以分布在计算机可读介质上,由可计算装置来执行,以实现上述各实施例中的事件处理方法的至少一个步骤;并且在某些情况下,可以采用不同于上述实施例所描述的顺序执行所示出或描述的至少一个步骤。
应当理解的是,在某些情况下,可以采用不同于上述实施例所描述的顺序执行所示出或描述的至少一个步骤。
本申请实施例还提供了一种计算机程序产品,包括计算机可读装置,该计算机可读装置上存储有如上所示的计算机程序。本申请实施例中该计算机可读装置可包括如上所示的计算机可读存储介质。
本申请实施例提供的一种事件处理方法、装置、终端及计算机可读存储介质,该事件处理方法通过获取设备的上报数据及设备所对应的规则,根据规则将上报数据进行分流并保存在对应的内存数据集中,从内存数据集中获取目标数据,目标数据至少包括上报数据,目标数据为匹配规则所需的数据,对目标数据进行计算并匹配规则。提供了一种对于复杂事件规则尤其是聚集类型的规则的问题的有效解决方法,方法较简单,耗时较短,提升用户体验度。
可见,本领域的技术人员应该明白,上文中所公开方法中的全部或某些步骤、系统、装置中的功能模块/单元可以被实施为软件(可以用计算装置可执行的计算机程序代码来实现)、固件、硬件及其适当的组合。在硬件实施方式中,在以上描述中提及的功能模块/单元之间的划分不一定对应于物理组件的划分;例如,一个物理组件可以具有多个功能,或者一个功能或步骤可以由若干物理组件合作执行。某些物理组件或所有物理组件可以被实施为由处理器,如中央处理器、数字信号处理器或微处理器执行的软件,或者被实施为硬件,或者被实施为集成电路,如专用集成电路。
此外,本领域普通技术人员公知的是,通信介质通常包含计算机可读指令、数据结构、计算机程序模块或者诸如载波或其他传输机制之类的调制数据信号 中的其他数据,并且可包括任何信息递送介质。所以,本申请不限制于任何特定的硬件和软件结合。
以上内容是结合具体的实施方式对本申请实施例所作的进一步详细说明,不能认定本申请的具体实施只局限于这些说明。对于本申请所属技术领域的普通技术人员来说,在不脱离本申请构思的前提下,还可以做出若干简单推演或替换,都应当视为属于本申请的保护范围。

Claims (18)

  1. 一种事件处理方法,包括:
    获取设备的上报数据;
    获取所述设备所对应的规则;
    根据所述规则将所述上报数据进行分流;
    将所述上报数据保存在对应的内存数据集中;
    从所述内存数据集中获取目标数据,所述目标数据至少包括所述上报数据,所述目标数据为匹配所述规则所需的数据;
    对所述目标数据进行计算并匹配所述规则。
  2. 如权利要求1所述的事件处理方法,其中,
    当所述目标数据多于所述上报数据时,所述内存数据集中还保存有历史上报数据;
    此时,所述目标数据包括所述上报数据和目标历史上报数据。
  3. 如权利要求2所述的事件处理方法,其中,所述对所述目标数据进行计算并匹配所述规则包括:
    滑动窗口对所述目标数据进行计算并匹配所述规则。
  4. 如权利要求3所述的事件处理方法,其中,所述滑动窗口对所述目标数据进行计算并匹配所述规则之后,还包括:
    对保存在所述内存数据集中超出滑动窗口所包括的所述历史上报数据进行释放。
  5. 如权利要求1-4任一项所述的事件处理方法,其中,所述获取设备的上报数据之前,还包括:
    建立所述设备与所述规则之间的映射关系以及所述规则与所述内存数据集之间的映射关系,其中所述规则与所述内存数据集之间的映射关系为一一映射。
  6. 如权利要求1-4任一项所述的事件处理方法,其中,所述根据所述规 则将所述上报数据进行分流之前,还包括:
    若所述上报数据的格式与预设格式不一致,则将所述上报数据的格式转换为预设格式后,根据所述规则将所述上报数据进行分流。
  7. 如权利要求1-4任一项所述的事件处理方法,其中,所述事件处理方法应用于以下至少之一:物联网云端、边缘节点。
  8. 如权利要求1-4任一项所述的事件处理方法,其中,所述对所述目标数据进行计算并匹配所述规则之后,还包括:
    若匹配所述规则成功,则执行相应的动作,所述动作包括以下至少之一:
    通知用户、上报物联网云端、控制对应的设备执行相应的动作。
  9. 一种事件处理装置,包括:
    第一获取模块,用于获取设备的上报数据;
    第二获取模块,用于获取所述设备所对应的规则;
    分流模块,用于根据所述规则将所述上报数据进行分流;
    内存数据集,用于保存对应的上报数据;
    第三获取模块,用于从所述内存数据集中获取目标数据,所述目标数据至少包括所述上报数据,所述目标数据为匹配所述规则所需的数据;
    计算匹配模块,用于对所述目标数据进行计算并匹配所述规则。
  10. 如权利要求9所述的事件处理装置,其中,
    当所述目标数据多于所述上报数据时,所述内存数据集中还保存有历史上报数据;
    此时,所述目标数据包括所述上报数据和目标历史上报数据。
  11. 如权利要求10所述的事件处理装置,其中,所述计算匹配模块包括滑动窗口。
  12. 如权利要求11所述的事件处理装置,其中,所述事件处理装置还包括:
    释放模块,用于在所述滑动窗口对所述目标数据进行计算并匹配所述规则之后,对保存在所述内存数据集中超出滑动窗口所包括的所述历史上报数据进行释放。
  13. 如权利要求9-12任一项所述的事件处理装置,其中,所述事件处理装置还包括:
    配置模块,用于在所述第一获取模块获取设备的上报数据之前,建立所述设备与所述规则之间的映射关系以及所述规则与所述内存数据集之间的映射关系,其中所述规则与所述内存数据集之间的映射关系为一一映射。
  14. 如权利要求9-12任一项所述的事件处理装置,其中,所述事件处理装置还包括:
    协议转换模块,用于所述分流模块根据所述规则将所述上报数据进行分流之前,若所述上报数据的格式与预设格式不一致,则将所述上报数据的格式转换为预设格式后,根据所述规则将所述上报数据进行分流。
  15. 如权利要求9-12任一项所述的事件处理装置,其中,所述事件处理装置还包括以下至少之一:物联网云端、边缘节点。
  16. 如权利要求9-12任一项所述的事件处理装置,其中,所述事件处理装置还包括:
    动作处理模块,用于若匹配所述规则成功,则执行相应的动作,所述动作包括以下至少之一:
    通知用户、上报物联网云端、控制对应的设备执行相应的动作。
  17. 一种事件处理终端,包括:处理器、存储器及通信总线;
    所述通信总线用于实现处理器和存储器之间的连接通信;
    所述处理器用于执行存储器中存储的一个或者多个计算机程序,以实现如权利要求1至8中任一项所述的事件处理方法的步骤。
  18. 一种计算机可读存储介质,其中,所述计算机可读存储介质存储有一个或者多个计算机程序,所述一个或者多个计算机程序可被一个或者多个处 理器执行,以实现如权利要求1至8中任一项所述的事件处理方法的步骤。
PCT/CN2020/112251 2019-09-24 2020-08-28 一种事件处理方法、装置、终端及计算机可读存储介质 WO2021057387A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910907179.1 2019-09-24
CN201910907179.1A CN112631740A (zh) 2019-09-24 2019-09-24 一种事件处理方法、装置、终端及计算机可读存储介质

Publications (1)

Publication Number Publication Date
WO2021057387A1 true WO2021057387A1 (zh) 2021-04-01

Family

ID=75165588

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/112251 WO2021057387A1 (zh) 2019-09-24 2020-08-28 一种事件处理方法、装置、终端及计算机可读存储介质

Country Status (2)

Country Link
CN (1) CN112631740A (zh)
WO (1) WO2021057387A1 (zh)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2023056943A1 (zh) * 2021-10-09 2023-04-13 天翼物联科技有限公司 基于物联网规则引擎的终端控制方法、装置、设备及介质
CN116502125A (zh) * 2023-04-28 2023-07-28 成都赛力斯科技有限公司 车辆事件划分方法、装置及车联网服务器

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116016822A (zh) * 2022-12-12 2023-04-25 天翼数字生活科技有限公司 监控设备数据存储方法、装置、存储介质及设备
CN116048866B (zh) * 2023-03-07 2023-06-09 浙江鹏信信息科技股份有限公司 基于实时流计算引擎的数据故障检测方法、系统及介质

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102473143A (zh) * 2009-07-23 2012-05-23 日本电气株式会社 事件处理系统、分配控制器、事件处理方法、分配控制方法和程序存储介质
CN104756079A (zh) * 2012-10-23 2015-07-01 日本电气株式会社 规则分配服务器、事件处理系统和方法以及程序
CN105138385A (zh) * 2015-08-25 2015-12-09 北京邮电大学 一种物联网复杂事件处理方法
CN106104525A (zh) * 2014-03-31 2016-11-09 华为技术有限公司 事件处理系统
US20170235783A1 (en) * 2016-02-17 2017-08-17 Verizon Patent And Licensing Inc. Rules execution system for iot devices
US20190278625A1 (en) * 2018-03-12 2019-09-12 Vmware, Inc. Rule-based reallocation of hosted compute resources

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102473143A (zh) * 2009-07-23 2012-05-23 日本电气株式会社 事件处理系统、分配控制器、事件处理方法、分配控制方法和程序存储介质
CN104756079A (zh) * 2012-10-23 2015-07-01 日本电气株式会社 规则分配服务器、事件处理系统和方法以及程序
CN106104525A (zh) * 2014-03-31 2016-11-09 华为技术有限公司 事件处理系统
CN105138385A (zh) * 2015-08-25 2015-12-09 北京邮电大学 一种物联网复杂事件处理方法
US20170235783A1 (en) * 2016-02-17 2017-08-17 Verizon Patent And Licensing Inc. Rules execution system for iot devices
US20190278625A1 (en) * 2018-03-12 2019-09-12 Vmware, Inc. Rule-based reallocation of hosted compute resources

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2023056943A1 (zh) * 2021-10-09 2023-04-13 天翼物联科技有限公司 基于物联网规则引擎的终端控制方法、装置、设备及介质
CN116502125A (zh) * 2023-04-28 2023-07-28 成都赛力斯科技有限公司 车辆事件划分方法、装置及车联网服务器
CN116502125B (zh) * 2023-04-28 2024-03-12 重庆赛力斯凤凰智创科技有限公司 车辆事件划分方法、装置及车联网服务器

Also Published As

Publication number Publication date
CN112631740A (zh) 2021-04-09

Similar Documents

Publication Publication Date Title
WO2021057387A1 (zh) 一种事件处理方法、装置、终端及计算机可读存储介质
CN110430079B (zh) 车路协同系统
US11616840B2 (en) Method, apparatus and system for processing unmanned vehicle data, and storage medium
US10696257B2 (en) Automatic crowd sensing and reporting system for road incidents
US10477375B2 (en) Communication between responders
WO2019128028A1 (zh) 一种道路交通数据的记录方法及车载设备
US20230049501A1 (en) Service processing method and apparatus, and storage medium
CN110708258B (zh) 流量控制方法、装置、服务器及存储介质
CN110232010A (zh) 一种告警方法、告警服务器及监控服务器
CN113220715B (zh) 一种数据处理方法、系统、计算机及可读存储介质
US20200004785A1 (en) Automatic grouping based on user behavior
US10735984B2 (en) Systems and methods for identifying user density from network data
US10819596B2 (en) System and method to access aggregated metric data in a computer network
EP3748913A1 (en) Link bandwidth utilization rate acquisition method and device, and terminal
US20240144815A1 (en) Method and system for collecting evidence following a vehicle incident
CN110198294B (zh) 安全攻击检测方法及装置
CN111399749B (zh) 一种数据处理系统及方法
US20240144735A1 (en) Method and system for providing evidence following a vehicle incident
CN116319810A (zh) 分布式系统的流量控制方法、装置、设备、介质及产品
WO2019184434A1 (zh) 一种基于gps实时位置大数据的信息处理方法、装置及其系统
US11171806B1 (en) Dynamic quality of service control for automotive ethernet
CN114501374A (zh) 车联网的动态服务部署方法、系统、装置及存储介质
WO2023134636A1 (zh) 视频告警处理方法、装置、系统、存储介质及电子装置
US20240146882A1 (en) Method and system for collecting and reporting evidence method and system for collecting and reporting evidence
US10789347B1 (en) Identification preprocessing

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20869823

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20869823

Country of ref document: EP

Kind code of ref document: A1

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 140223)

122 Ep: pct application non-entry in european phase

Ref document number: 20869823

Country of ref document: EP

Kind code of ref document: A1