CN116301750A - Rule engine system of Internet of things and execution method - Google Patents
Rule engine system of Internet of things and execution method Download PDFInfo
- Publication number
- CN116301750A CN116301750A CN202310190902.5A CN202310190902A CN116301750A CN 116301750 A CN116301750 A CN 116301750A CN 202310190902 A CN202310190902 A CN 202310190902A CN 116301750 A CN116301750 A CN 116301750A
- Authority
- CN
- China
- Prior art keywords
- rule
- node
- message
- chain
- execution
- 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
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/20—Software design
- G06F8/24—Object-oriented
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; 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
- G06F9/448—Execution paradigms, e.g. implementations of programming paradigms
- G06F9/4488—Object-oriented
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; 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/54—Interprogram communication
- G06F9/546—Message passing systems or structures, e.g. queues
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02P—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
- Y02P90/00—Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
- Y02P90/02—Total factory control, e.g. smart factories, flexible manufacturing systems [FMS] or integrated manufacturing systems [IMS]
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Computer And Data Communications (AREA)
Abstract
Description
技术领域technical field
本公开涉及物联网技术领域,具体涉及一种物联网规则引擎系统和执行方法。The present disclosure relates to the technical field of the Internet of Things, and in particular to an Internet of Things rule engine system and execution method.
背景技术Background technique
随着物联网行业的飞速发展,物联网技术也不断取得创新和突破,规则引擎作为物联网平台的核心功能系统,是处理各种复杂业务逻辑的引擎,相当于物联网平台的大脑。利用规则引擎,物联网平台每天可处理海量设备数据和系统内部消息数据,实现海量数据复制业务逻辑的灵活处理。目前现有的物联网平台规则引擎,虽然能实现上至万亿级海量数据的业务逻辑处理,但是易用性较差,缺乏可视化、组件化、定制化且简单易用的规则配置功能,没有规则链调试功能,系统出现问题或故障难以定位分析,功能较单一,不够丰富和完善。With the rapid development of the Internet of Things industry, the Internet of Things technology has also made continuous innovations and breakthroughs. As the core functional system of the Internet of Things platform, the rule engine is the engine for processing various complex business logics, which is equivalent to the brain of the Internet of Things platform. Using the rule engine, the IoT platform can process massive amounts of device data and system internal message data every day, realizing the flexible processing of massive data replication business logic. Although the existing IoT platform rule engine can realize the business logic processing of trillions of massive data, it is not easy to use, and lacks visualization, componentization, customization and easy-to-use rule configuration functions. With the rule chain debugging function, it is difficult to locate and analyze system problems or faults. The function is relatively single, and it is not rich and perfect enough.
发明内容Contents of the invention
本公开旨在至少解决现有技术中存在的技术问题之一,提供一种物联网规则引擎系统和执行方法。The present disclosure aims to solve at least one of the technical problems existing in the prior art, and provides an Internet of Things rule engine system and execution method.
本公开的一个方面,提供了一种物联网规则引擎系统,包括:An aspect of the present disclosure provides an Internet of Things rule engine system, including:
规则节点组件模块,用于预设多个规则节点组件;Rule node component module, used to preset multiple rule node components;
规则管理模块,用于对所述多个规则节点组件进行配置,得到规则链执行链路;A rule management module, configured to configure the plurality of rule node components to obtain a rule chain execution link;
规则引擎模块,用于根据消息获取对应的所述规则链执行链路,并执行所述规则链执行链路中的规则节点组件。The rule engine module is configured to obtain the corresponding rule chain execution link according to the message, and execute the rule node component in the rule chain execution link.
可选的,所述规则引擎模块,包括:Optionally, the rule engine module includes:
消息路由器,用于根据所述规则链执行链路得到路由信息;A message router, configured to execute a link according to the rule chain to obtain routing information;
规则链执行处理器,用于根据所述路由信息调用对应的规则节点执行处理器;A rule chain execution processor, configured to call a corresponding rule node execution processor according to the routing information;
规则节点执行处理器,用于响应所述规则链执行处理器的调用请求,以调用对应的规则节点逻辑处理器;The rule node execution processor is used to respond to the invocation request of the rule chain execution processor to invoke the corresponding rule node logic processor;
规则节点逻辑处理器,用于执行对应的规则节点组件功能。The rule node logical processor is used to execute the function of the corresponding rule node component.
可选的,所述消息路由器还用于根据所述消息得到对应的根规则链,并根据所述规则链执行链路中配置的顺序,从所述根规则链开始将需要执行的规则节点组件的路由信息发送至所述规则链执行处理器。Optionally, the message router is further configured to obtain the corresponding root rule chain according to the message, and according to the order configured in the rule chain execution link, the rule node components that need to be executed start from the root rule chain The routing information of is sent to the rule chain execution processor.
可选的,所述规则节点组件包括后置链路配置信息,所述规则节点逻辑处理器还用于,当执行完所述规则链执行链路的最后一个规则节点组件后,根据所述最后一个规则节点组件中的后置链路配置信息得到下一个待执行的规则链执行链路并发送至所述消息路由器。Optionally, the rule node component includes post-link configuration information, and the rule node logic processor is further configured to, after executing the last rule node component of the rule chain execution link, according to the last The post-link configuration information in a rule node component obtains the execution link of the next rule chain to be executed and sends it to the message router.
可选的,所述规则管理模块还用于生成可视化的规则节点组件以及规则节点组件连接线,并根据选用的规则节点组件以及选用的规则节点组件之间的连接线,得到所述规则链执行链路,并生成对应的可视化的规则链执行链路图。Optionally, the rule management module is also used to generate visualized rule node components and rule node component connection lines, and obtain the rule chain execution according to the selected rule node components and the connection lines between the selected rule node components link, and generate a corresponding visualized rule chain execution link graph.
可选的,所述规则管理模块还用于根据选用的调试设备和调试数据,调试所述规则链执行链路,并生成可视化的调试过程和调试结果。Optionally, the rule management module is further configured to debug the rule chain execution link according to the selected debugging device and debugging data, and generate a visualized debugging process and debugging results.
可选的,所述规则管理模块还用于场景规则管理,将选用的场景设置为定时场景或非定时场景。Optionally, the rule management module is also used for scene rule management, setting the selected scene as a timed scene or a non-timed scene.
可选的,所述规则管理模块还用于,若将所述选用的场景设置为定时场景,则根据场景设置为所述选用的场景匹配对应的定时模板,根据所述定时模板生成定时任务,根据所述定时任务配置自动执行的定时场景规则链执行链路。Optionally, the rule management module is further configured to, if the selected scene is set as a timing scene, match the selected scene with a corresponding timing template according to the scenario setting, and generate a timing task according to the timing template, The timing scenario rule chain execution link that is automatically executed according to the configuration of the timing task.
可选的,所述系统还包括:Optionally, the system also includes:
告警管理模块,用于根据所述规则节点逻辑处理器中规则节点组件的执行结果进行告警或消除告警。An alarm management module, configured to issue an alarm or eliminate an alarm according to the execution result of the rule node component in the rule node logic processor.
本公开的另一个方面,还提供了一种物联网规则引擎执行方法,包括:Another aspect of the present disclosure also provides a method for executing an Internet of Things rule engine, including:
预设多个规则节点组件;Preset multiple rule node components;
对所述多个规则节点组件进行配置,得到规则链执行链路;Configuring the plurality of rule node components to obtain a rule chain execution link;
根据消息获取对应的所述规则链执行链路,并执行所述规则链执行链路中的规则节点组件。Obtain the corresponding rule chain execution link according to the message, and execute the rule node components in the rule chain execution link.
本公开的另一个方面,还提供了一种电子设备,包括:Another aspect of the present disclosure also provides an electronic device, including:
一个或多个处理器;one or more processors;
存储单元,用于存储一个或多个程序,当所述一个或多个程序被所述一个或多个处理器执行时,能使得所述一个或多个处理器实现前文记载的物联网规则引擎执行方法。The storage unit is used to store one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors can realize the Internet of Things rule engine described above Execution method.
本公开的另一个方面,还提供了一种计算机可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时能实现前文记载的物联网规则引擎执行方法。Another aspect of the present disclosure further provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the method for executing the Internet of Things rule engine described above can be realized.
本公开实施例的一种物联网规则引擎系统,通过规则节点组件模块来实现对规则节点组件的预设,通过规则管理模块实现对预设的规则节点组件的配置管理,形成不同的规则链执行链路,用不同的规则节点组件对应不同功能的规则节点,实现了组件化、定制化和流程化的规则管理功能,实现了对规则链的简单灵活配置,从而可以基于消息驱动实时处理物联网设备上报数据或系统内部消息处理,通过组件化、定制化、流程化处理各种物联网数据,实现各种智能化、自动化物联网业务处理。An Internet of Things rule engine system according to an embodiment of the present disclosure realizes the preset rule node components through the rule node component module, realizes the configuration management of the preset rule node components through the rule management module, and forms different rule chain executions Link, using different rule node components to correspond to rule nodes with different functions, realizes componentized, customized and process-based rule management functions, and realizes simple and flexible configuration of rule chains, so that the Internet of Things can be processed in real time based on message-driven The data reported by the equipment or the internal message processing of the system can be processed through componentization, customization, and process-based processing of various IoT data to realize various intelligent and automated IoT business processing.
附图说明Description of drawings
图1为用于实现根据本公开一实施例的一种物联网规则引擎系统和执行方法的示例电子设备的示意性框图;1 is a schematic block diagram of an example electronic device for implementing an Internet of Things rule engine system and execution method according to an embodiment of the present disclosure;
图2为本公开另一实施例的一种物联网规则引擎系统的结构示意图;2 is a schematic structural diagram of an Internet of Things rule engine system according to another embodiment of the present disclosure;
图3为本公开另一实施例的一种规则引擎模块的结构示意图;FIG. 3 is a schematic structural diagram of a rule engine module according to another embodiment of the present disclosure;
图4为本公开另一实施例的一种物联网规则引擎系统的消息处理流程示意图;4 is a schematic diagram of a message processing flow of an Internet of Things rule engine system according to another embodiment of the present disclosure;
图5为本公开另一实施例的一种物联网规则引擎执行方法的流程示意图。FIG. 5 is a schematic flowchart of a method for executing an Internet of Things rule engine according to another embodiment of the present disclosure.
具体实施方式Detailed ways
为使本领域技术人员更好地理解本公开的技术方案,下面结合附图和具体实施方式对本公开作进一步详细描述。In order to enable those skilled in the art to better understand the technical solution of the present disclosure, the present disclosure will be described in further detail below in conjunction with the accompanying drawings and specific embodiments.
为使本领域技术人员更好地理解本公开的技术方案,下面结合附图和具体实施方式对本公开作进一步详细描述。显然,所描述的实施例是本公开的一部分实施例,而不是全部的实施例。基于所描述的本公开的实施例,本领域普通技术人员在无需创造性劳动的前提下所获得的所有其他实施例,都属于本公开保护的范围。In order to enable those skilled in the art to better understand the technical solution of the present disclosure, the present disclosure will be described in further detail below in conjunction with the accompanying drawings and specific embodiments. Apparently, the described embodiments are some of the embodiments of the present disclosure, not all of them. Based on the described embodiments of the present disclosure, all other embodiments obtained by persons of ordinary skill in the art without creative effort fall within the protection scope of the present disclosure.
除非另外具体说明,本公开中使用的技术术语或者科学术语应当为本公开所属领域内具有一般技能的人士所理解的通常意义。本公开中使用的“包括”或者“包含”等既不限定所提及的形状、数字、步骤、动作、操作、构件、原件和/或它们的组,也不排除出现或加入一个或多个其他不同的形状、数字、步骤、动作、操作、构件、原件和/或它们的组,或加入这些。在本公开的描述中,“多个”的含义是两个或两个以上,除非另有明确具体的限定。Unless otherwise specified, technical terms or scientific terms used in the present disclosure shall have the usual meanings understood by those skilled in the art to which the present disclosure belongs. "Include" or "comprising" used in this disclosure neither limit the mentioned shapes, numbers, steps, actions, operations, components, elements and/or their groups, nor exclude the occurrence or addition of one or more Other different shapes, figures, steps, actions, operations, components, elements and/or groups thereof, or additions to these. In the description of the present disclosure, "plurality" means two or more, unless otherwise specifically defined.
在更加详细地讨论之前应当提到的是,一些示例性实施例被描述成作为流程图描绘的处理或方法。虽然流程图将各项操作(步骤)描述成顺序的处理,但是其中的许多操作可以被并行地、并发地或者同时实施。此外,各项操作的顺序可以被重新安排。当操作完成时所述处理可以被终止,但是还可以具有未包括在附图中的附加步骤。所述处理可以对应于方法、函数、规程、子例程、子程序等等。Before discussing in more detail, it should be mentioned that some exemplary embodiments are described as processes or methods depicted as flowcharts. Although the flowcharts describe operations (steps) as sequential processing, many of the operations may be performed in parallel, concurrently, or simultaneously. In addition, the order of operations can be rearranged. The process may be terminated when operations are complete, but may also have additional steps not included in the figure. The processing may correspond to a method, function, procedure, subroutine, subroutine, or the like.
首先,参照图1来描述用于实现本公开一实施例的一种物联网规则引擎系统和执行方法及电子设备。Firstly, an Internet of Things rule engine system, execution method, and electronic device for implementing an embodiment of the present disclosure are described with reference to FIG. 1 .
如图1所示,电子设备300包括一个或多个处理器310、一个或多个存储装置320、输入装置330、输出装置340等,这些组件通过总线系统和/或其他形式的连接机构350互连。应当注意,图1所示的电子设备的组件和结构只是示例性的,而非限制性的,根据需要,所述电子设备也可以具有其他组件和结构。As shown in FIG. 1 , an
所述处理器310可以是中央处理单元(CPU)或者具有数据处理能力和/或指令执行能力的其他形式的处理单元,并且可以控制所述电子设备中的其他组件以执行期望的功能。The processor 310 may be a central processing unit (CPU) or other forms of processing units with data processing capabilities and/or instruction execution capabilities, and may control other components in the electronic device to perform desired functions.
所述存储装置320可以包括一个或多个计算机程序产品,所述计算机程序产品可以包括各种形式的计算机可读存储介质,例如易失性存储器和/或非易失性存储器。所述易失性存储器例如可以包括随机存取存储器(RAM)和/或高速缓冲存储器(cache)等。所述非易失性存储器例如可以包括只读存储器(ROM)、硬盘、闪存等。在所述计算机可读存储介质上可以存储一个或多个计算机程序指令,处理器可以运行所述程序指令,以实现下文所述的本公开实施例中(由处理器实现)的客户端功能以及/或者其他期望的功能。在所述计算机可读存储介质中还可以存储各种应用程序和各种数据,例如,所述应用程序使用和/或产生的各种数据等。The storage device 320 may include one or more computer program products, and the computer program products may include various forms of computer-readable storage media, such as volatile memory and/or non-volatile memory. The volatile memory may include, for example, random access memory (RAM) and/or cache memory (cache). The non-volatile memory may include, for example, a read-only memory (ROM), a hard disk, a flash memory, and the like. One or more computer program instructions may be stored on the computer-readable storage medium, and the processor may execute the program instructions to realize the client functions (implemented by the processor) in the embodiments of the present disclosure described below and / or other desired functionality. Various application programs and various data, for example, various data used and/or generated by the application programs, may also be stored in the computer-readable storage medium.
所述输入装置330可以是用户用来输入指令的装置,并且可以包括键盘、鼠标、麦克风和触摸屏等中的一个或多个。The input device 330 may be a device used by a user to input instructions, and may include one or more of a keyboard, a mouse, a microphone, and a touch screen.
所述输出装置340可以向外部(例如用户)输出各种信息(例如图像或声音),并且可以包括显示器、扬声器等中的一个或多个。The output device 340 may output various information (such as images or sounds) to the outside (such as a user), and may include one or more of a display, a speaker, and the like.
下面,将参考图2描述根据本公开另一实施例的一种物联网规则引擎系统。Next, an Internet of Things rule engine system according to another embodiment of the present disclosure will be described with reference to FIG. 2 .
如图2所示,一种物联网规则引擎系统100,包括规则节点组件模块110、规则管理模块120、规则引擎模块130,具体的:As shown in Figure 2, a
规则节点组件模块110,用于预设多个规则节点组件。The rule node component module 110 is configured to preset multiple rule node components.
示例性的,在本实施例中,将需要执行的物联网中不同功能或业务的规则节点分别用对应的规则节点组件来表示,从而将物联网中的规则节点进行了组件化处理。Exemplarily, in this embodiment, the rule nodes of different functions or services in the Internet of Things that need to be executed are represented by corresponding rule node components, so that the rule nodes in the Internet of Things are componentized.
具体地,规则节点组件模块提供规则节点组件定义,包括配置参数定义和逻辑处理代码定义。示例性的,规则引擎系统可以仅提供基本的规则节点组件,也可以根据实际的使用需求,定制开发扩展其它功能的规则节点组件,也就是说,规则节点组件模块可以仅预设基本的规则节点组件,也可以根据实际的使用需求,预设定制开发扩展其他功能的规则节点组件,本实施例中不进行具体限制。Specifically, the rule node component module provides rule node component definitions, including configuration parameter definitions and logic processing code definitions. Exemplarily, the rule engine system can only provide basic rule node components, and can also customize and develop rule node components that extend other functions according to actual usage requirements, that is, the rule node component module can only preset basic rule nodes Components can also be preset, custom-developed and extended to rule node components with other functions according to actual usage requirements, which is not specifically limited in this embodiment.
示例性的,基本的规则节点组件如下:Exemplary, basic rule node components are as follows:
消息类型过滤节点:根据消息类型过滤消息;Message type filter node: filter messages according to message type;
消息类型路由节点:根据消息类型路由消息;Message type routing node: route messages according to message type;
JS脚本过滤节点:根据简单的JavaScript脚本过滤消息;JS script filter node: filter messages according to simple JavaScript script;
JS脚本路由节点:根据简单的JavaScript脚本路由消息;JS script routing node: route messages according to simple JavaScript scripts;
JS脚本转换节点:根据JavaScript脚本对消息进行转换处理;JS script conversion node: convert and process messages according to JavaScript scripts;
产品路由节点:根据设备上报消息对应的产品编号路由消息;Product routing node: route the message according to the product number corresponding to the message reported by the device;
设备路由节点:根据设备上报消息对应的设备编号路由消息;Device routing node: route the message according to the device number corresponding to the message reported by the device;
事件路由节点:根据设备上报事件消息对应的事件编码路由消息;Event routing node: route messages according to the event code corresponding to the event message reported by the device;
数据筛选节点:根据设备上报属性消息中属性参数值筛选过滤消息,或根据设备上报事件消息中的事件参数值筛选过滤消息;Data filtering node: filter and filter messages according to the attribute parameter values in the attribute messages reported by the device, or filter and filter messages according to the event parameter values in the event messages reported by the devices;
生成告警节点:根据配置规则自动触发生成告警信息;Generate alarm node: Automatically trigger and generate alarm information according to configuration rules;
消除告警节点:根据配置规则自动触发消除告警消息;Eliminate the alarm node: automatically trigger the elimination of the alarm message according to the configuration rules;
消息分发节点:将消息按对应设备授权用户和配置的数据权限进行topic分发,用于将消息推送到kafka或其它消息中间件对应的topic;Message distribution node: Distribute messages according to topics authorized by corresponding device users and configured data permissions, and push messages to topics corresponding to kafka or other message middleware;
RestAPI调用节点:触发调用第三方RestAPI接口,可以将消息数据以参数形式发送给第三方接口;RestAPI call node: triggers the call to the third-party RestAPI interface, and can send message data to the third-party interface in the form of parameters;
发送到kafka节点:将消息推送到kafka;Send to kafka node: push the message to kafka;
发送到MQTT节点:将消息推送到MQTT;Send to MQTT node: push the message to MQTT;
时序数据存储节点:将设备上报属性数据或事件数据通过数据存储模块存储到Elasticsearch库;Time series data storage node: store the attribute data or event data reported by the device to the Elasticsearch library through the data storage module;
服务调用节点:调用设备指令服务,可以指定某个产品下的所有设备或选择某个产品下的1个或多个设备进行调用,也可以动态调用本消息对应的设备,根据对应产品物模型选择服务、设置服务输入参数;Service call node: call device instruction service, you can specify all devices under a certain product or select one or more devices under a certain product to call, or dynamically call the device corresponding to this message, and select according to the corresponding product model Service, setting service input parameters;
属性设置节点:调用设备属性设置指令,选择一个设备,选择其中一个可以设置的属性,输入属性值进行设置。Attribute setting node: Call the device attribute setting command, select a device, select one of the attributes that can be set, and input the attribute value to set.
规则管理模块120,用于对所述多个规则节点组件进行配置,得到规则链执行链路。The
具体地,规则管理模块,负责管理规则链配置数据,通过规则链配置数据对规则节点组件之间的连接关系进行配置,得到配置好的确定连接关系的规则节点组件,也就是规则链执行链路。示例性的,在规则管理模块中,可根据具体的使用需求进行规则节点组件的配置,本实施例中并不进行具体限制。Specifically, the rule management module is responsible for managing the rule chain configuration data, configures the connection relationship between the rule node components through the rule chain configuration data, and obtains the configured rule node components that determine the connection relationship, that is, the rule chain execution link . Exemplarily, in the rule management module, the rule node component can be configured according to specific usage requirements, which is not specifically limited in this embodiment.
示例性的,规则管理模块可通过上述方式实现新增规则链、修改规则链、设置规则链、删除规则链、设置根规则链、查询规则链、查看规则链等功能。Exemplarily, the rule management module can implement functions such as adding a rule chain, modifying a rule chain, setting a rule chain, deleting a rule chain, setting a root rule chain, querying a rule chain, and viewing a rule chain through the above-mentioned method.
规则引擎模块130,用于根据消息获取对应的所述规则链执行链路,并执行所述规则链执行链路中的规则节点组件。The
具体地,规则引擎模块,负责以消息驱动的方式执行规则链处理业务,也就是说,消息对应了待处理业务,规则引擎模块根据接收到的消息,从规则管理模块获取到与消息对应的待执行的规则链执行链路,并将规则链执行链路中的规则节点组件按照预设的连接关系进行执行,当执行完所有的规则节点组件后,也就执行完成了消息对应的待处理业务。Specifically, the rule engine module is responsible for executing the rule chain processing business in a message-driven manner. The executed rule chain executes the link, and executes the rule node components in the rule chain execution link according to the preset connection relationship. When all the rule node components are executed, the pending business corresponding to the message is executed .
需要说明的是,消息包括通过监听kafka或其它消息中间件实时接收设备接入的消息数据或物联网平台其它模块推送的消息数据。It should be noted that the message includes the message data received by the real-time receiving device through monitoring kafka or other message middleware or the message data pushed by other modules of the Internet of Things platform.
示例性的,消息类型包括:设备信息、设备状态信息、设备上报属性消息、设备上报事件消息、设备指令下发消息、告警消息、场景驱动消息、规则链配置变更消息。消息数据为json格式,消息包括消息头和消息体,消息头主要包括消息唯一标识、消息时间戳、消息类型、项目编号、消息元数据。Exemplarily, the message types include: device information, device status information, device reported attribute message, device reported event message, device instruction issued message, alarm message, scene-driven message, rule chain configuration change message. The message data is in json format. The message includes a message header and a message body. The message header mainly includes the message unique identifier, message timestamp, message type, item number, and message metadata.
示例性的,消息元数据为json格式,主要包括设备编号、产品编号、设备名称、产品名称以及不同消息类型对应的扩展元数据属性字段。消息体为json字符串格式,根据每种消息类型决定消息体内容,比如设备上报属性消息的消息体为设备上报的属性数据,设备上报事件消息的消息体为设备事件数据。Exemplarily, the message metadata is in json format, mainly including device number, product number, device name, product name, and extended metadata attribute fields corresponding to different message types. The message body is in json string format, and the content of the message body is determined according to each message type. For example, the message body of the property message reported by the device is the property data reported by the device, and the message body of the event message reported by the device is the device event data.
需要说明的是,上述消息类型和消息元数据格式等仅为示例性说明,本领域技术人员可根据实际的使用情况进行具体设定。It should be noted that the above-mentioned message types and message metadata formats are only illustrative, and those skilled in the art can make specific settings according to actual usage conditions.
本公开实施例的一种物联网规则引擎系统,通过规则节点组件模块来实现对规则节点组件的预设,通过规则管理模块实现对预设的规则节点组件的配置管理,形成不同的规则链执行链路,用不同的规则节点组件对应不同功能的规则节点,实现了组件化、定制化和流程化的规则管理功能,实现了对规则链的简单灵活配置,从而可以基于消息驱动实时处理物联网设备上报数据或系统内部消息处理,通过组件化、定制化、流程化处理各种物联网数据,实现各种智能化、自动化物联网业务处理。An Internet of Things rule engine system according to an embodiment of the present disclosure realizes the preset rule node components through the rule node component module, realizes the configuration management of the preset rule node components through the rule management module, and forms different rule chain executions Link, using different rule node components to correspond to rule nodes with different functions, realizes componentized, customized and process-based rule management functions, and realizes simple and flexible configuration of rule chains, so that the Internet of Things can be processed in real time based on message-driven The data reported by the equipment or the internal message processing of the system can be processed through componentization, customization, and process-based processing of various IoT data to realize various intelligent and automated IoT business processing.
下面,将结合图2进一步阐述本公开另一实施例的一种物联网规则引擎系统。Next, an Internet of Things rule engine system according to another embodiment of the present disclosure will be further described with reference to FIG. 2 .
示例性的,如图2所示,本公开实施例的一种物联网规则引擎系统100,还包括设备接入模块140、告警管理模块150、数据存储模块160,具体地:Exemplarily, as shown in FIG. 2 , an IoT
设备接入模块140,用于与设备进行消息的接收与发送。The
示例性的,设备为与物联网配合使用的各类设备,例如水压设备、办公室的投影、手机等设备,本实施例中不进行具体限制。Exemplarily, the device is various devices used in conjunction with the Internet of Things, such as water pressure equipment, office projectors, mobile phones and other devices, which are not specifically limited in this embodiment.
示例性的,设备接入模块,负责对接设备数据,并将设备数据以实时消息为载体通过kafka或其它消息中间件实时推送给规则引擎模块进行处理。示例性的,设备数据包括设备基本信息,设备采集的属性数据、事件数据、告警数据。示例性的,对接设备的方式包括通过各种物联网协议(如MQTT、OPC、KNX等)直接对接设备、对接设备网关、对接第三方设备管理系统。示例性的,设备接入模块还用于向设备下发设备指令服务和设备属性设置指令。本领域技术人员可根据实际的使用情况选择不同的方式设置设备数据与规则引擎模块之间的交互方式、设备数据包括的信息、设备连接方式等,本实施例中不进行具体限制。Exemplarily, the device access module is responsible for docking device data, and pushes the device data to the rule engine module in real time through kafka or other message middleware with real-time messages as the carrier for processing. Exemplarily, the device data includes basic device information, attribute data, event data, and alarm data collected by the device. Exemplarily, the way of interfacing with devices includes directly interfacing with devices through various Internet of Things protocols (such as MQTT, OPC, KNX, etc.), interfacing with device gateways, and interfacing with third-party device management systems. Exemplarily, the device access module is also used to issue device instruction services and device attribute setting instructions to the device. Those skilled in the art can choose different ways to set the interaction mode between the device data and the rule engine module, the information included in the device data, the device connection mode, etc. according to the actual usage, and no specific limitations are set in this embodiment.
示例性的,当规则引擎模块与设备接入模块进行连接时,可选择前文已阐述的基本的规则节点组件中的服务调用节点和属性设置节点,以实现调用设备接入模块提供的Rest API接口向设备发送指令的功能。Exemplarily, when the rule engine module is connected with the device access module, the service call node and attribute setting node in the basic rule node components described above can be selected to implement the call to the Rest API interface provided by the device access module The ability to send commands to the device.
告警管理模块150,用于根据所述规则节点组件的执行结果进行告警或消除告警。The
示例性的,告警管理模块,负责管理告警数据,提供告警管理界面,示例性的,包括查询告警、查看告警、处理告警、统计告警等功能,示例性的,还包括提供新增告警和修改告警的API接口给告警规则节点和消除告警规则节点。示例性的,处理告警主要包括确认告警或消除告警,修改对应告警状态,同时输入相关备注说明,也就是说,告警管理模块根据不同的规则节点组件不同的执行结果得到告警数据,根据不同的告警数据选择需要执行的告警相关功能。需要说明的是,本领域技术人员可根据实际的使用情况选择不同的告警功能的设计方式,本实施例中不进行具体限制。Exemplarily, the alarm management module is responsible for managing alarm data and providing an alarm management interface. Exemplarily, it includes functions such as querying alarms, viewing alarms, processing alarms, and counting alarms. Exemplarily, it also includes providing new alarms and modifying alarms. The API interface is given to the alarm rule node and the alarm elimination rule node. Exemplarily, processing an alarm mainly includes confirming an alarm or eliminating an alarm, modifying the corresponding alarm state, and inputting relevant remarks at the same time, that is to say, the alarm management module obtains alarm data according to different execution results of different rule node components, and according to different alarm Data selects the alarm-related functions that need to be performed. It should be noted that those skilled in the art may choose different design manners of the alarm function according to actual usage conditions, which are not specifically limited in this embodiment.
数据存储模块160,用于数据存储与管理。The
具体地,在数据存储模块中,所述数据存储模块,负责数据存储管理,包括规则链配置数据的存储管理,设备相关配置数据存储管理,设备上报数据存储管理,其中配置相关数据存储在MySQL等关系型数据库,设备上报的属性数据、事件数据以及其它日志数据存储在Elasticsearch库中,用于上搜索查询或统计分析。Specifically, in the data storage module, the data storage module is responsible for data storage management, including storage management of rule chain configuration data, storage management of device-related configuration data, storage management of device-reported data, wherein configuration-related data is stored in MySQL, etc. Relational database, attribute data, event data and other log data reported by devices are stored in the Elasticsearch library for online search queries or statistical analysis.
具体地,在数据存储模块中,规则节点组件模块可将对规则节点组件的定义数据存储在数据存储模块中,规则管理模块可将对规则节点组件的配置数据、也就是规则链执行链路存储在数据存储模块中,规则引擎模块可以根据接收到的消息从数据存储模块中调用已经存储了的规则节点组件以及对应的配置数据,也就是调用规则链执行链路,以完成后续对规则节点组件的执行。此外,数据存储模块还可用于告警数据的存储和查询,以及用于设备采集上报数据的存储,示例性的,可由规则节点组件模块定义的时序数据存储规则节点的业务逻辑处理单元在规则链执行链路执行时存储数据。Specifically, in the data storage module, the rule node component module can store the definition data of the rule node component in the data storage module, and the rule management module can store the configuration data of the rule node component, that is, the execution link of the rule chain In the data storage module, the rule engine module can call the stored rule node component and the corresponding configuration data from the data storage module according to the received message, that is, call the rule chain execution link to complete the subsequent rule node component execution. In addition, the data storage module can also be used for storage and query of alarm data, as well as storage of data collected and reported by equipment. Exemplarily, the business logic processing unit of the time series data storage rule node defined by the rule node component module is executed in the rule chain Store data while the link is executing.
本公开实施例的一种物联网规则引擎系统,进一步阐述了设备接入模块、告警管理模块和数据存储模块,使得系统进一步实现自动存储或转发数据、自动生成告警消息、数据存储和转发功能。An Internet of Things rule engine system according to an embodiment of the present disclosure further elaborates a device access module, an alarm management module, and a data storage module, so that the system can further realize the functions of automatically storing or forwarding data, automatically generating alarm messages, and storing and forwarding data.
下面,将结合图3进一步阐述本公开另一实施例的规则引擎模块。Next, the rule engine module of another embodiment of the present disclosure will be further described with reference to FIG. 3 .
示例性的,所述规则引擎模块130,包括消息路由器131、规则链执行处理器132、规则节点执行处理器133、规则节点逻辑处理器134,具体的:Exemplarily, the
消息路由器131,用于根据所述规则链执行链路得到路由信息。The
具体地,消息路由器,负责管理规则引擎系统内部消息的路由信息。示例性的,消息路由器根据接收到的规则链执行链路,查询获取规则链执行链路中规则节点组件对应的路由信息,并发送给规则链执行处理器。示例性的,可由规则链执行处理器根据消息头中的项目编号从数据存储模块中调用出消息对应的规则链执行链路,然后将规则链执行链路发给消息路由器,再由消息路由器查询对应的路由信息返回给规则链执行处理器。Specifically, the message router is responsible for managing the routing information of messages inside the rule engine system. Exemplarily, the message router queries and acquires the routing information corresponding to the rule node component in the rule chain execution link according to the received rule chain execution link, and sends it to the rule chain execution processor. Exemplarily, the rule chain execution processor can call out the rule chain execution link corresponding to the message from the data storage module according to the item number in the message header, and then send the rule chain execution link to the message router, and then the message router can query The corresponding routing information is returned to the rule chain execution processor.
示例性的,规则链执行处理器在系统初始化或收到规则链配置变更消息时,通知消息路由器进行初始化处理,从规则管理模块获取规则链配置数据并据此生成路由表,也就是说,路由表中包括每个规则节点组件或嵌套规则链的路由信息,通过上述过程完成消息路由器的路由配置初始化处理。Exemplarily, the rule chain execution processor notifies the message router to perform initialization processing when the system is initialized or receives a rule chain configuration change message, obtains the rule chain configuration data from the rule management module and generates a routing table accordingly, that is, the routing table The table includes the routing information of each rule node component or nested rule chain, and the routing configuration initialization processing of the message router is completed through the above process.
规则链执行处理器132,用于根据所述路由信息调用对应的规则节点执行处理器。The rule chain execution processor 132 is configured to invoke a corresponding rule node execution processor according to the routing information.
具体地,规则链执行处理器获取消息进行处理,示例性的,规则链执行处理器根据消息头中的项目编号从消息路由器中查询获取项目编号对应的规则链执行链路的路由信息,根据路由消息调用对应的规则节点执行处理器,从而对规则链执行链路上对应的规则节点或嵌套规则链进行处理。Specifically, the rule chain execution processor acquires the message for processing. Exemplarily, the rule chain execution processor queries the message router to obtain the routing information of the rule chain execution link corresponding to the item number according to the item number in the message header. The message calls the corresponding rule node execution processor, so as to process the corresponding rule node or nested rule chain on the rule chain execution link.
规则节点执行处理器133,用于响应所述规则链执行处理器的调用请求,以调用对应的规则节点逻辑处理器。The rule node execution processor 133 is configured to respond to the call request of the rule chain execution processor to call the corresponding rule node logic processor.
具体地,规则节点执行处理器,负责接收规则链执行处理器的调用执行请求,然后调用对应的规则节点逻辑处理器对消息进行处理。Specifically, the rule node execution processor is responsible for receiving the call execution request of the rule chain execution processor, and then calls the corresponding rule node logic processor to process the message.
示例性的,规则节点执行处理器在系统初始化时或收到规则节点组件变更消息时,对规则节点组件进行初始化处理。Exemplarily, the rule node execution processor initializes the rule node component when the system is initialized or receives a rule node component change message.
规则节点逻辑处理器134,用于执行对应的规则节点组件功能。The rule node logic processor 134 is configured to execute the function of the corresponding rule node component.
具体地,规则节点逻辑处理器,负责接收规则节点执行处理器的调用执行请求,根据定义的逻辑处理代码对消息进行处理,也就是通过具体执行逻辑处理代码来实现对应的规则节点组件的功能。需要说明的是,规则节点逻辑处理器中的逻辑处理代码是在规则节点组件中定义和管理,规则节点逻辑处理器仅负责执行逻辑处理代码。Specifically, the rule node logic processor is responsible for receiving the call execution request of the rule node execution processor, and processing the message according to the defined logic processing code, that is, realizing the function of the corresponding rule node component by specifically executing the logic processing code. It should be noted that the logic processing code in the rule node logic processor is defined and managed in the rule node component, and the rule node logic processor is only responsible for executing the logic processing code.
示例性的,规则节点逻辑处理器在系统初始化时或收到规则节点组件变更消息时进行初始化处理,从规则管理模块加载对应的规则节点组件的配置信息,设置对应的配置参数。Exemplarily, the rule node logic processor performs initialization processing when the system is initialized or receives a rule node component change message, loads configuration information of the corresponding rule node component from the rule management module, and sets corresponding configuration parameters.
本公开实施例的一种物联网规则引擎系统,进一步阐述了规则引擎模块的具体结构,实现了根据消息查询规则链执行链路的路由信息,并根据路由信息分别执行不同的规则节点逻辑处理器的功能,通过不同的规则节点逻辑处理器来执行不同的规则节点的逻辑处理代码,进一步通过组件化实现对消息的处理。An Internet of Things rule engine system in the embodiment of the present disclosure further elaborates the specific structure of the rule engine module, realizes querying the routing information of the rule chain execution link according to the message, and executes different rule node logic processors according to the routing information The function of different rule node logic processors is used to execute the logic processing code of different rule nodes, and further realize the processing of messages through componentization.
下面,将进一步阐述本公开另一实施例的规则引擎模块。Next, the rule engine module of another embodiment of the present disclosure will be further described.
示例性的,所述消息路由器131,还用于根据所述消息得到对应的根规则链,并根据所述规则链执行链路中配置的顺序,从所述根规则链开始将需要执行的规则节点组件的路由信息发送至所述规则链执行处理器。Exemplarily, the
示例性的,在规则链执行处理器获取消息的路由信息时,消息路由器先根据消息头中的项目编号找到项目对应的根规则链,从根规则链开始根据规则链配置的链路执行规则链,也就是说,消息路由器从所述根规则链开始将需要执行的规则节点组件的路由信息发送至所述规则链执行处理器,再由规则链执行处理器根据需要执行的规则节点组件的路由信息调用规则节点执行处理器,再由规则节点执行处理器调用对应的规则节点逻辑处理器,最后由规则节点逻辑处理器具体执行对应的逻辑处理代码,从而完成了对该规则节点的处理,按照上述方法从根规则链开始依次处理规则链执行链路中的各个规则节点组件,从而完成对整个规则链执行链路的处理,进而完成了对消息的处理。Exemplarily, when the rule chain execution processor obtains the routing information of the message, the message router first finds the root rule chain corresponding to the item according to the item number in the message header, and executes the rule chain according to the link configured by the rule chain from the root rule chain , that is to say, the message router sends the routing information of the rule node components to be executed from the root rule chain to the rule chain execution processor, and then the rule chain execution processor executes the routing information of the rule node components as needed The information calls the rule node execution processor, and then the rule node execution processor calls the corresponding rule node logic processor, and finally the rule node logic processor specifically executes the corresponding logic processing code, thus completing the processing of the rule node, according to The above method sequentially processes each rule node component in the rule chain execution link starting from the root rule chain, thereby completing the processing of the entire rule chain execution link, and further completing the processing of the message.
需要说明的是,每个消息有且只有一个根规则链,也就是说,每个项目编号仅对应一个根规则链,根规则链的第一个规则节点是规则引擎执行规则链处理消息的入口。It should be noted that each message has one and only one root rule chain, that is, each item number corresponds to only one root rule chain, and the first rule node of the root rule chain is the entry point for the rule engine to execute the rule chain to process messages .
示例性的,所述规则节点组件包括后置链路配置信息,所述规则节点逻辑处理器134还用于,当执行完所述规则链执行链路的最后一个规则节点组件后,根据所述最后一个规则节点组件中的后置链路配置信息得到下一个待执行的规则链执行链路并发送至所述消息路由器。Exemplarily, the rule node component includes post-link configuration information, and the rule node logic processor 134 is further configured to, after executing the last rule node component of the rule chain execution link, according to the The post-link configuration information in the last rule node component obtains the execution link of the next rule chain to be executed and sends it to the message router.
示例性的,规则节点逻辑处理器对消息执行处理后指定下一个待执行规则链执行链路,再由消息路由器查找对应的规则链执行链路的路由信息并返回给规则链执行处理器,规则链执行处理器按前文阐述的方式进行调用规则节点执行处理器、调用规则节点逻辑处理器对下一个待执行的规则链执行链路进行处理。Exemplarily, the rule node logic processor specifies the next rule chain execution link to be executed after processing the message, and then the message router searches for the routing information of the corresponding rule chain execution link and returns it to the rule chain execution processor. The chain execution processor calls the rule node execution processor and the rule node logic processor to process the next rule chain execution link to be executed in the manner described above.
本公开实施例的一种物联网规则引擎系统,进一步阐述了路由器和规则链执行处理器从根规则节点开始执行规则链执行链路,以及规则节点逻辑处理器对下一个待执行的规则链执行链路的指定,进一步提高了系统在规则链执行链路处理方面的自动化和智能化,提高了对物联网消息处理的自动化和智能化。An Internet of Things rule engine system in an embodiment of the present disclosure further elaborates that the router and the rule chain execution processor execute the rule chain execution link from the root rule node, and the rule node logic processor executes the next rule chain to be executed The designation of the link further improves the automation and intelligence of the system in the link processing of the rule chain execution, and improves the automation and intelligence of the Internet of Things message processing.
下面,将进一步阐述本公开另一实施例的规则引擎模块。Next, the rule engine module of another embodiment of the present disclosure will be further described.
示例性的,所述规则引擎模块130,还包括消息接收器135和消息缓存器136,具体的:Exemplarily, the
所述消息接收器135,用于接收消息,发送给消息缓存器。示例性的,消息接收器通过监听kafka或其它消息中间件实时接收设备接入模块或物联网平台其它模块推送的消息数据。消息接收器接收到消息后,对消息做简单转换和包装处理,再将消息发送到消息缓存器。The
所述消息缓存器136,用于进行消息缓存,以供规则链执行处理器获取缓存消息。示例性的,消息缓存器用于将规则引擎内部消息缓存到kafka或规则引擎服务器内存中的消息队列。示例性的,若规则引擎模块包括消息缓存器,则规则链执行处理器从消息缓存器获取消息进行处理。The
本公开实施例的一种物联网规则引擎系统,进一步阐述了规则引擎模块中的消息接收器和消息缓存器,使得规则引擎模块具备了缓存功能,提高了处理效率。The Internet of Things rule engine system in the embodiment of the present disclosure further elaborates the message receiver and message buffer in the rule engine module, so that the rule engine module has a cache function and improves processing efficiency.
下面,将进一步阐述本公开另一实施例的规则管理模块。Next, the rule management module of another embodiment of the present disclosure will be further described.
示例性的,规则管理模块120还用于向使用者提供规则链管理界面和场景规则管理界面,示例性,使用者包括项目管理员,管理界面可为Web管理界面。Exemplarily, the
示例性的,规则管理模块120还用于根据根规则链设置信息来设置消息的根规则链,具体地,可在规则链管理界面上将消息对应的任意一个规则链执行链路设置为根规则链,也就是将项目编号对应的任意一个规则链执行链路设置为根规则链,其它规则链执行链路可以嵌套设置在根规则链的链路中。Exemplarily, the
示例性的,规则管理模块120还用于生成可视化的规则节点组件以及规则节点组件连接线,并根据选用的规则节点组件以及选用的规则节点组件之间的连接线,得到所述规则链执行链路,并生成对应的可视化的规则链执行链路图。具体地,规则管理模块的设置规则链功能,用于动态配置规则链执行链路图,提供可视化、组件化设置界面。规则链路执行链路图由开始节点、规则节点、连接线、内嵌规则链节点组成。系统提供定义好的规则节点组件及规则链节点,项目管理员可以将需要执行的规则节点组件拖拽到画布上进行配置,配置每个节点的名称和参数信息,再通过拖拉连接线将节点按照需要的逻辑连接起来。规则链执行链路上可以内嵌其它规则链,以规则链节点的形式展现。Exemplarily, the
示例性的,规则管理模块120还用于根据选用的调试设备和调试数据,调试所述规则链执行链路,并生成可视化的调试过程和调试结果。具体地,规则管理模块的规则链调试功能,可以选择调试设备,选择属性上报或者事件上报,输入属性上报或者事件上报模拟数据,可以以物模型形式输入每个属性字段值或事件参数值,也可以直接以json格式直接输入属性上报或事件上报模拟数据,点击规则链管理界面上的执行按钮由后台生成设备属性上报消息或者事件上报消息,推送给规则引擎执行,同时规则链管理界面上展示该规则链执行链路图,以特殊效果动态展示执行到的规则节点组件和连接线,执行完成后界面下放展示执行结果信息。Exemplarily, the
示例性的,规则管理模块120还用于场景规则管理,将选用的场景设置为定时场景或非定时场景。具体地,规则管理模块的场景规则管理功能包括新增场景规则、修改场景规则、设置场景规则、删除场景规则、查询场景规则、查看场景规则、执行场景规则;在新增场景规则和修改场景规则时,可将新增或修改的场景设置是否定时场景。Exemplarily, the
示例性的,规则管理模块120还用于,若将所述选用的场景设置为定时场景,则根据场景设置为所述选用的场景匹配对应的定时模板,根据所述定时模板生成定时任务,根据所述定时任务配置自动执行的定时场景规则链执行链路。具体地,如果将场景选择为定时场景,可以选择定时模板,根据定时模板自动生成定时任务Cron表达式,也可手动配置定时任务Cron表达式,由后台根据定时任务配置自动执行定时场景规则。Exemplarily, the
示例性的,规则管理模块的执行场景规则功能可以由项目管理员用户在界面上人工触发执行场景规则,同时提供API接口给第三方系统调用执行。Exemplarily, the execution scenario rule function of the rule management module can be manually triggered by the project administrator user on the interface to execute the scenario rule, and at the same time provide an API interface for third-party system calls to execute.
本公开实施例的一种物联网规则引擎系统,进一步阐述了规则管理模块的规则管理功能、调试功能和定时场景设置功能,规则管理模块,规则管理模块课根据定时任务触发场景规则处理,自动下发设备指令,并可实现规则链调试,可视化展示规则链执行流程和效果,与其它常见规则引擎系统或开源规则引擎相比,具有简单易用、扩展性强、功能更丰富等优势,此外,提供场景规则链的定时触发、人工界面触发、第三方接口触发,提供规则链可视化调试功能,动态可视化展示规则链执行流程和逻辑,扩展性强。An Internet of Things rule engine system according to an embodiment of the present disclosure further elaborates the rule management function, debugging function, and timing scene setting function of the rule management module. Send device instructions, and implement rule chain debugging, visually display the execution process and effect of rule chains. Compared with other common rule engine systems or open source rule engines, it has the advantages of ease of use, strong scalability, and richer functions. In addition, Provides timing triggering, manual interface triggering, and third-party interface triggering of scene rule chains, provides visual debugging functions for rule chains, dynamically and visually displays the execution process and logic of rule chains, and has strong scalability.
下面,将结合实例进一步阐述一种物联网规则引擎系统的工作流程。In the following, the workflow of an Internet of Things rule engine system will be further described with examples.
示例性的,如图4所示,描述了本实施例中一种物联网规则引擎系统对消息处理的流程的示例,由设备接入模块采集设备数据,以消息的形式实时推送到kafka,规则引擎模块的消息接收器从kafka实时接收消息,进行简单包装处理,再将消息推送给规则引擎的消息缓存器,规则链执行处理器从消息缓存器实时接收获取消息,根据消息头中的项目编号从消息路由器获取规则链执行路由,先调用根规则链的第一个规则节点执行处理消息,处理完后根据路由连接判断是否最后一个规则节点,如果不是,则根据路由继续执行下一个规则节点处理消息,如果是最后一个规则节点则结束处理。Exemplarily, as shown in FIG. 4 , an example of the message processing flow of an Internet of Things rule engine system in this embodiment is described. The device access module collects device data and pushes it to Kafka in real time in the form of a message. The rule The message receiver of the engine module receives messages from kafka in real time, performs simple packaging processing, and then pushes the messages to the message buffer of the rule engine, and the rule chain execution processor receives and obtains messages from the message buffer in real time, according to the item number in the message header Get the rule chain from the message router to execute routing, first call the first rule node of the root rule chain to process the message, after processing, judge whether it is the last rule node according to the routing connection, if not, continue to execute the next rule node processing according to the route message, if it is the last rule node, the processing ends.
示例性的,若规则节点组件选用消息类型过滤节点来处理设备上报消息,则本实施例中的一种物联网规则引擎系统按下述流程进行消息处理:设备接入模块接收设备上报消息数据,并将其发送至规则引擎模块,触发规则引擎模块获取消息对应的规则链执行链路并执行,也就是执行消息类型过滤节点,先通过消息类型过滤节点过滤消息,如果消息是设备上报属性消息,则执行时序数据存储规则节点,将设备上报属性数据通过接口发送给数据存储模块存储到Elasticsearch库,如果消息不是设备上报属性消息,则直接结束处理。Exemplarily, if the rule node component selects the message type filter node to process the message reported by the device, then an Internet of Things rule engine system in this embodiment performs message processing according to the following process: the device access module receives the message data reported by the device, And send it to the rule engine module, trigger the rule engine module to obtain and execute the rule chain execution link corresponding to the message, that is, to execute the message type filter node, first filter the message through the message type filter node, if the message is an attribute message reported by the device, Then execute the timing data storage rule node, and send the attribute data reported by the device to the data storage module through the interface and store it in the Elasticsearch library. If the message is not the attribute message reported by the device, the processing will end directly.
示例性的,若规则节点组件选用消息类型过滤节点、产品规则节点、数据筛选节点、生成告警规则节点来进行水压产品告警处理,则本实施例中的一种物联网规则引擎系统按下述流程进行消息处理:设备接入模块接收设备上报消息数据,并将其发送至规则引擎模块,触发规则引擎模块获取消息对应的规则链执行链路并执行,也就是执行消息类型过滤节点,先通过消息类型过滤节点过滤消息,如果消息是设备上报属性消息,则执行产品规则节点按产品过滤消息,如果是水压产品,则执行数据筛选节点,过滤出水压值小于0.1MPa的消息数据,然后执行生成告警规则节点,根据生成告警规则节点配置自动生成告警消息数据,通过接口发送给告警管理模块保存。如果不是设备上报属性消息、或不是水压产品对应的设备上报的消息,或设备上报属性消息中的水压值不小于0.1MPa,则直接结束处理。Exemplarily, if the rule node component selects the message type filter node, product rule node, data filter node, and alarm generation rule node to process the water pressure product alarm, then a rule engine system of the Internet of Things in this embodiment is as follows Process for message processing: the device access module receives the message data reported by the device and sends it to the rule engine module, which triggers the rule engine module to obtain the rule chain execution link corresponding to the message and execute it, that is, execute the message type filter node, first pass The message type filtering node filters messages. If the message is an attribute message reported by the device, execute the product rule node to filter the message by product. If it is a water pressure product, execute the data filtering node to filter out the message data whose water pressure value is less than 0.1MPa, and then Execute the generating alarm rule node, automatically generate alarm message data according to the configuration of the generating alarm rule node, and send it to the alarm management module through the interface for storage. If the attribute message is not reported by the device, or the message is not reported by the device corresponding to the water pressure product, or the water pressure value in the attribute message reported by the device is not less than 0.1MPa, then the processing is directly ended.
示例性的,若规则节点组件选用消息类型过滤节点、产品规则节点、事件规则节点、服务调用规则节点来进行会议室设备控制处理,则本实施例中的一种物联网规则引擎系统按下述流程进行消息处理:设备接入模块接收设备上报消息数据,并将其发送至规则引擎模块,触发规则引擎模块获取消息对应的规则链执行链路并执行,也就是执行消息类型过滤节点,先通过消息类型过滤节点过滤消息,如果是设备上报事件消息,则执行产品规则节点按产品过滤消息,如果是会议室pad产品,则执行事件规则节点,按事件过滤消息,如果是会议室开门日志事件,则执行服务调用规则节点调用本会议室对应的窗帘设备服务打开窗帘,再执行服务调用规则节点调用本会议室对应的空调设备打开空调。如果不是设备上报属性消息、或不是会议室pad产品对应的设备上报的消息,或设备上报事件消息不是会议室开门日志事件,则直接结束处理。Exemplarily, if the rule node component selects the message type filter node, product rule node, event rule node, and service call rule node to perform conference room device control processing, then a rule engine system of the Internet of Things in this embodiment is as follows Process for message processing: the device access module receives the message data reported by the device and sends it to the rule engine module, which triggers the rule engine module to obtain the rule chain execution link corresponding to the message and execute it, that is, execute the message type filter node, first pass The message type filtering node filters messages. If the event message is reported by the device, execute the product rule node to filter the message by product. If it is a conference room pad product, execute the event rule node to filter the message by event. If it is a conference room door opening log event, Then execute the service call rule node to call the curtain device service corresponding to the conference room to open the curtains, and then execute the service call rule node to call the air conditioner corresponding to the conference room to turn on the air conditioner. If the attribute message is not reported by the device, or the message is not reported by the device corresponding to the conference room pad product, or the event message reported by the device is not the conference room door opening log event, the processing is directly ended.
示例性的,也可将会议室设备控制的场景设置为定时场景,例如,项目管理员通过规则管理模块在场景规则管理界面新增场景规则“办公大厅下班场景”,设置为定时场景,配置定时任务执行Cron表达式,例如,每天18:00下班时执行,设置场景规则链执行链路,例如,设置属性设置规则节点,用于关闭办公大厅所有灯光,设置属性设置规则节点,用于关闭办公大厅空调,设置服务调用规则节点,用于机器人自动消毒。新建场景规则提交后,后台自动创建场景规则定时任务,每天18:00触发执行,执行时先新增场景驱动消息,将驱动消息推送给规则引擎模块执行处理,规则引擎模块执行该场景规则设置的规则链执行链路进行处理。Exemplarily, the scene controlled by the conference room equipment can also be set as a timing scene. For example, the project administrator adds a scene rule "office scene in the office lobby" on the scene rule management interface through the rule management module, sets it as a timing scene, and configures the timing The task executes the Cron expression, for example, it is executed at 18:00 every day, and the scene rule chain execution link is set, for example, the property setting rule node is used to turn off all lights in the office lobby, and the attribute setting rule node is used to close the office Hall air conditioner, set service call rule node for automatic disinfection of robots. After the new scene rule is submitted, the background automatically creates a scheduled task for the scene rule, which is triggered to execute at 18:00 every day. When executing, first add a scene driving message, push the driving message to the rule engine module for processing, and the rule engine module executes the setting of the scene rule Rule chains execute chains for processing.
示例性的,上述会议室设备控制的场景支持人工触发立即执行场景规则或第三方系统调用本系统提供的API接口触发执行场景规则,场景规则可以是定时任务场景或非定时任务场景,后台执行时也是先新增场景驱动消息,将驱动消息推送给规则引擎模块执行处理,规则引擎模块执行该场景规则设置的规则链路进行处理。Exemplarily, the scenarios controlled by the above-mentioned meeting room devices support manual triggering of immediate execution of scenario rules or a third-party system calls the API interface provided by the system to trigger the execution of scenario rules. The scenario rules can be scheduled task scenarios or non-scheduled task scenarios. It is also the first to add a scene-driven message, push the drive message to the rule engine module for processing, and the rule engine module executes the rule link set by the scene rule for processing.
示例性的,规则管理模块在执行调试功能时,项目管理员在规则管理界面选择一个配置好的规则链执行链路,点击“调试规则链”按钮进入调试界面,选择一个调试设备,选择属性上报或事件上报,输入属性值或事件参数值,点击“提交”按钮提交调试请求,后台根据提交数据自动生成设备上报消息,将消息推送给规则引擎模块执行,规则引擎模块记录规则链调试信息并推送给规则管理模块,主要记录当前执行规则节点和前一个执行规则节点,规则管理模块将调试消息通过WebSocket实时返回给界面,界面动态实时展示规则链执行流程效果,如果规则链调试执行完毕则界面展示调试结果信息,否则等待继续执行。Exemplarily, when the rule management module executes the debugging function, the project administrator selects a configured rule chain execution link on the rule management interface, clicks the "debug rule chain" button to enter the debugging interface, selects a debugging device, and selects the attribute report Or event reporting, input the attribute value or event parameter value, click the "Submit" button to submit the debugging request, the background will automatically generate the device reporting message according to the submitted data, and push the message to the rule engine module for execution, and the rule engine module will record the rule chain debugging information and push it For the rule management module, it mainly records the current execution rule node and the previous execution rule node. The rule management module returns the debugging message to the interface in real time through WebSocket. The interface dynamically displays the effect of the rule chain execution process in real time. If the rule chain debugging is completed, the interface will display Debugging result information, otherwise wait to continue execution.
下面,结合图5描述本公开另一实施例的一种物联网规则引擎执行方法,包括:Next, a method for executing an Internet of Things rule engine according to another embodiment of the present disclosure is described in conjunction with FIG. 5 , including:
S100:预设多个规则节点组件。S100: Presetting multiple rule node components.
S200:对所述多个规则节点组件进行配置,得到规则链执行链路。S200: Configure the multiple rule node components to obtain a rule chain execution link.
S300:根据消息获取对应的所述规则链执行链路,并执行所述规则链执行链路中的规则节点组件。S300: Obtain the corresponding rule chain execution link according to the message, and execute the rule node component in the rule chain execution link.
本公开实施例的一种物联网规则引擎执行方法,对规则节点组件的预设,对预设的规则节点组件的配置管理,形成不同的规则链执行链路,用不同的规则节点组件对应不同功能的规则节点,实现了组件化、定制化和流程化的规则管理功能,实现了对规则链的简单灵活配置,从而可以基于消息驱动实时处理物联网设备上报数据或系统内部消息处理,通过组件化、定制化、流程化处理各种物联网数据,实现各种智能化、自动化物联网业务处理。An Internet of Things rule engine execution method according to an embodiment of the present disclosure, preset rule node components, configure and manage preset rule node components, form different rule chain execution links, and use different rule node components to correspond to different The functional rule node realizes componentized, customized and process-based rule management functions, and realizes simple and flexible configuration of rule chains, so that real-time processing of data reported by IoT devices or internal message processing of the system can be processed based on message-driven, through components Customized, customized, and process-based processing of various IoT data to realize various intelligent and automated IoT business processing.
进一步的,本实施例中还公开了一种电子设备,包括:Further, this embodiment also discloses an electronic device, including:
一个或多个处理器;one or more processors;
存储单元,用于存储一个或多个程序,当所述一个或多个程序被所述一个或多个处理器执行时,能使得所述一个或多个处理器实现前文记载的一种物联网规则引擎执行方法。The storage unit is used to store one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors can realize the aforementioned Internet of Things Rule engine execution method.
进一步的,本实施例中还公开了一种计算机可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时能实现前文记载的一种物联网规则引擎执行方法。Further, this embodiment also discloses a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, it can implement the aforementioned method for executing an Internet of Things rule engine.
其中,计算机可读介质可以是本公开的装置、设备、系统中所包含的,也可以是单独存在。Wherein, the computer-readable medium may be included in the apparatus, device, or system of the present disclosure, or may exist independently.
其中,计算机可读存储介质可是任何包含或存储程序的有形介质,其可以是电、磁、光、电磁、红外线、半导体的系统、装置、设备,更具体的例子包括但不限于:具有一个或多个导线的电连接、便携式计算机磁盘、硬盘、光纤、随机访问存储器(RAM)、只读存储器(ROM)、可擦式可编程只读存储器(EPROM或闪存)、便携式紧凑磁盘只读存储器(CD-ROM)、光存储器件、磁存储器件,或它们任意合适的组合。Among them, the computer-readable storage medium can be any tangible medium containing or storing programs, which can be electrical, magnetic, optical, electromagnetic, infrared, semiconductor systems, devices, and equipment. More specific examples include but are not limited to: having one or Electrical connection of multiple wires, portable computer disks, hard disks, optical fibers, random access memory (RAM), read only memory (ROM), erasable programmable read only memory (EPROM or flash memory), portable compact disk read only memory ( CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
其中,计算机可读存储介质也可包括在基带中或作为载波一部分传播的数据信号,其中承载了计算机可读的程序代码,其具体的例子包括但不限于电磁信号、光信号,或它们任意合适的组合。Wherein, the computer-readable storage medium may also include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program codes therein. Specific examples thereof include but are not limited to electromagnetic signals, optical signals, or any suitable The combination.
在本说明书的描述中,参考术语“一个实施例”、“一些实施例”、“示例”、“具体示例”、或“一些示例”等的描述意指结合该实施例或示例描述的具体特征、结构、材料或者特点包含于本公开的至少一个实施例或示例中。在本说明书中,对上述术语的示意性表述不必须针对的是相同的实施例或示例。而且,描述的具体特征、结构、材料或者特点可以在任一个或多个实施例或示例中以合适的方式结合。此外,在不相互矛盾的情况下,本领域的技术人员可以将本说明书中描述的不同实施例或示例以及不同实施例或示例的特征进行结合和组合。In the description of this specification, descriptions referring to the terms "one embodiment", "some embodiments", "example", "specific examples", or "some examples" mean that specific features described in connection with the embodiment or example , structure, material or characteristic is included in at least one embodiment or example of the present disclosure. In this specification, the schematic representations of the above terms are not necessarily directed to the same embodiment or example. Furthermore, the described specific features, structures, materials or characteristics may be combined in any suitable manner in any one or more embodiments or examples. In addition, those skilled in the art can combine and combine different embodiments or examples and features of different embodiments or examples described in this specification without conflicting with each other.
可以理解的是,以上实施方式仅仅是为了说明本公开的原理而采用的示例性实施方式,然而本公开并不局限于此。对于本领域内的普通技术人员而言,在不脱离本公开的精神和实质的情况下,可以做出各种变型和改进,这些变型和改进也视为本公开的保护范围。It can be understood that, the above implementations are only exemplary implementations adopted to illustrate the principle of the present disclosure, but the present disclosure is not limited thereto. For those skilled in the art, without departing from the spirit and essence of the present disclosure, various modifications and improvements can be made, and these modifications and improvements are also regarded as the protection scope of the present disclosure.
Claims (10)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202310190902.5A CN116301750A (en) | 2023-03-02 | 2023-03-02 | Rule engine system of Internet of things and execution method |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202310190902.5A CN116301750A (en) | 2023-03-02 | 2023-03-02 | Rule engine system of Internet of things and execution method |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| CN116301750A true CN116301750A (en) | 2023-06-23 |
Family
ID=86782772
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202310190902.5A Pending CN116301750A (en) | 2023-03-02 | 2023-03-02 | Rule engine system of Internet of things and execution method |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN116301750A (en) |
Citations (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN114338738A (en) * | 2021-12-23 | 2022-04-12 | 中国联合网络通信集团有限公司 | Actor model-based rule engine and scene linkage implementation method |
| CN114637776A (en) * | 2021-12-31 | 2022-06-17 | 北京航天智造科技发展有限公司 | Data management method and device based on rule engine |
| CN115250237A (en) * | 2022-07-18 | 2022-10-28 | 浪潮软件集团有限公司 | Method and device for rule engine of Internet of Things |
-
2023
- 2023-03-02 CN CN202310190902.5A patent/CN116301750A/en active Pending
Patent Citations (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN114338738A (en) * | 2021-12-23 | 2022-04-12 | 中国联合网络通信集团有限公司 | Actor model-based rule engine and scene linkage implementation method |
| CN114637776A (en) * | 2021-12-31 | 2022-06-17 | 北京航天智造科技发展有限公司 | Data management method and device based on rule engine |
| CN115250237A (en) * | 2022-07-18 | 2022-10-28 | 浪潮软件集团有限公司 | Method and device for rule engine of Internet of Things |
Non-Patent Citations (1)
| Title |
|---|
| 韦赫城: "物联网教学平台中规则引擎的设计与实现", 中国优秀硕士学位论文全文数据库 社会科学Ⅱ辑, no. 1, 15 January 2022 (2022-01-15), pages 131 - 22 * |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US11736378B1 (en) | Collaborative incident management for networked computing systems | |
| US11855863B1 (en) | Animated visualizations of network activity across network address spaces | |
| US20250068639A1 (en) | Visualizations of query results using generated files | |
| CN107273286B (en) | Scenario automation testing platform and method for task application | |
| CN110609906B (en) | Knowledge graph construction method and device, storage medium and electronic terminal | |
| Madden et al. | TinyDB: In-network query processing in tinyos | |
| US11995381B2 (en) | Two-tier capacity planning | |
| US12190083B2 (en) | Key-based logging for processing of structured data items with executable logic | |
| US11514006B2 (en) | Modifying event generation rules responsive to detected schema changes | |
| CN109726216A (en) | A kind of data processing method and processing system based on directed acyclic graph | |
| CN106302008A (en) | Data-updating method and device | |
| WO2022228156A1 (en) | Policy orchestration processing method, apparatus, device and system and storage medium | |
| CN108595316A (en) | Life cycle management method, manager, equipment and the medium of Distributed Application | |
| CN112631754A (en) | Data processing method, data processing device, storage medium and electronic device | |
| CN106681808A (en) | Task scheduling method and device | |
| CN115480753A (en) | Application integration system and corresponding computer device and storage medium | |
| US9208058B2 (en) | Providing directional debugging breakpoints | |
| US20060020931A1 (en) | Method and apparatus for managing complex processes | |
| CN107577709A (en) | A kind of graphically managing method of information system resources model | |
| CN116301750A (en) | Rule engine system of Internet of things and execution method | |
| CN112199075B (en) | Intelligent information processing method and framework system based on micro-service | |
| CN109033483A (en) | A kind of method, apparatus and system defining data relationship in YANG model | |
| US12158884B1 (en) | Embedded tokens for searches in rendering dashboards | |
| US20230315514A1 (en) | Configuration-driven data processing pipeline for an extensibility platform | |
| US12417090B1 (en) | Software development observability platform |
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 |