A CEP rule update method based on Flink streaming engine

By loading the initial rules in the Flink streaming engine and converting them into special event streams, the CEP rules are directly updated on the downstream operator nodes, which solves the problem that the existing technology cannot update the downstream operator nodes and needs to rewrite the business code, and achieves simplified updates. processes and efficiency-improving effects.

CN112506939BActive Publication Date: 2024-10-18FUJIAN STRAIT INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202011443193.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-12-08
Publication Date
2024-10-18
Estimated Expiration
2040-12-08

AI Technical Summary

Technical Problem

The existing CEP rule update method cannot update downstream operator nodes, and the business code needs to be rewritten to update CEP rules, which complicates the update process.

Method used

By loading the initial rules from an external file, the rule data that needs to be updated is obtained, converted into an event stream with special flags, and multiple event streams are generated based on the parallelism of the downstream operator, and the rules are updated directly at the downstream operator node to avoid additional business. deal with.

Benefits of technology

It implements rule updates for downstream operator nodes, simplifying the update process, reducing costs, and improving work efficiency. There is no need to pause and restart, and the initial rules are directly loaded for new task updates, saving time and functional workflow.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112506939B_ABST
    Figure CN112506939B_ABST
Patent Text Reader

Abstract

The present invention discloses a CEP rule updating method based on Flink streaming engine, which relates to the technical field of CEP rule updating method, and includes the following steps: each task loads the initial rules from an external file, and stores them in memory according to key-value pairs; another task accesses the event stream from an external message engine, and analyzes according to the loaded rules; obtains the rule data that needs to be updated from an external cache or system, and then broadcasts it, and combines it with the event stream. In the present invention, the task accesses the event stream from an external message engine, analyzes according to the loaded rules, obtains the rule data that needs to be updated from an external cache or system, and then broadcasts it. It only needs to obtain the rules once from the rule library, and at the same time converts the updated rules into an event stream with special marks. If there is only one parallelism of the downstream operator, one event is generated. If there are multiple, multiple corresponding events are generated, and the type field of the event is changed to the rule type, the event number is changed to the rule number, and other corresponding fields are also updated.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a CEP rule updating method, and relates to the technical field of CEP rule updating methods, and in particular to a CEP rule updating method based on a Flink streaming engine. Background Art

[0002] The data stream engine generally updates rules by reading from the cache, generating a rule stream, and then combining it with the event stream. The original rules are replaced at the combined node, and the new rules can be used for analysis. Although the streams are combined, the events of the two streams must be processed separately. In addition, the CEP library cannot directly analyze the event stream, and additional business logic code needs to be added for analysis. The existing technology has the following problems:

[0003] 1. The existing rule update method can only update the operator nodes of the combined flow, but cannot update the operator nodes downstream of the combined flow;

[0004] 2. The existing rule update method is fine for general rule updates, but for CEP rules, the business code needs to be rewritten. Summary of the invention

[0005] The present invention provides a CEP rule updating method based on the Flink streaming engine, one of the purposes of which is to have the ability to update downstream operator nodes and solve the problem that only operator nodes combined with streams can be updated; another purpose is to solve the problem that CEP rules need to be rewritten and then updated in business code, so as to achieve the effect of simplifying the update process.

[0006] In order to solve the above technical problems, the technical solution adopted by the present invention is:

[0007] One aspect is a CEP rule update method based on the Flink streaming engine, which includes the following steps:

[0008] Step 1: Each task loads the initial rules from an external file and saves them in memory according to key-value pairs. In addition, the task accesses the event stream from the external message engine and analyzes it according to the loaded rules.

[0009] Step 2: Obtain the rule data that needs to be updated from the external cache or system, then broadcast it and combine it with the event stream. Each task obtains the combined stream at this operator node.

[0010] Step 3: Compare the update rule number with the key of the operator node in step 2. If they are the same, convert the update rule into an event stream with a special mark. If there are multiple concurrent nodes at this time, it is necessary to copy multiple rule events according to the rules, set the values ​​of different specified fields, and then deliver the event stream to the downstream operator of this task.

[0011] Step 4: The operator node to be analyzed compares the numbering information and version information of the special event flow with the existing rules of this node. If they are consistent, the rule is updated and the new rule is used for real-time correlation analysis.

[0012] A further improvement of the technical solution of the present invention is that the initial rules in step 1 are a plurality of rule lists containing rule numbers.

[0013] A further improvement of the technical solution of the present invention is that: in the step 3, the number of the update rule in the rule flow is compared with the key of the rule of the operator node to be updated, and if the comparison result is inconsistent, the update rule is ignored.

[0014] A further improvement of the technical solution of the present invention is that: in the step three, the number of the update rule in the rule flow is compared with the key of the rule of the operator node that needs to be updated. If the comparison results are consistent, the update rule is converted into an event stream with a special mark, and multiple events are generated accordingly according to the parallelism of the downstream operator. The type field of the event is changed to the rule type, the event number is changed to the rule number, and other corresponding fields are also updated.

[0015] A further improvement of the technical solution of the present invention is that: when the event stream is delivered to the downstream operator of this task in step three, if the event stream is an event stream containing a special mark, the downstream operator in step four compares the event type and number with the rules used in the operator. If the type is a rule type, the operator updates the existing rules. If it is an event type, the current rules are used to analyze the event.

[0016] Another aspect is a CEP rule updating method based on the Flink streaming engine, and the CEP rule updating method based on the Flink streaming engine also includes the following steps:

[0017] S1: At the combined flow node where the event flow and the rule flow are combined, the rule flow is updated, and the event flow is analyzed after the rule is updated;

[0018] S2: After the updated rules analyze the event stream, additional processing services are written, and the newly written processing services are used to perform correlation analysis on each event, thereby completing the rule update for all operator nodes.

[0019] Due to the adoption of the above technical solution, the present invention has the following technical advances compared with the prior art:

[0020] 1. The present invention provides a CEP rule updating method based on the Flink streaming engine. In the present invention, a task accesses an event stream from an external message engine, performs analysis according to the loaded rules, obtains the rule data that needs to be updated from an external cache or system, and then broadcasts it. It only needs to obtain the rule once from the rule library, and at the same time, converts the updated rule into an event stream with a special mark. According to the parallelism of the downstream operator, multiple corresponding events are generated, the type field of the event is changed to the rule type, the event number is changed to the rule number, and other corresponding fields are also updated. Then, the event stream with a special mark is delivered to the downstream operator of this task. The downstream operator compares the event type and number with the rules used in the operator. If the type is a rule type, the operator updates the existing rule. If it is an event type, the current rule is used to analyze the event, thereby completing the update of the downstream operator node, so that the rule update only needs to obtain the rule once from the rule library to update the downstream operator node.

[0021] 2. The present invention provides a CEP rule updating method based on the Flink streaming engine. The invention compares the key of the operator node in step 2 with the number of the update rule. If the comparison results are the same, the update rule is converted into an event stream with a special mark. If there are multiple concurrent nodes at this time, it is necessary to copy multiple rule events according to the rules, and set the values ​​of different specified fields. Then, the event stream is delivered to the downstream operator of this task. The analyzed operator node compares the number information and version information of the special event stream with the existing rules of this node. Only if they are consistent, the rule is updated, and the new rule is used for real-time correlation analysis. In the whole process, the event stream delivered to the downstream operator can be directly analyzed for correlation, and no additional business processing is required, which can reduce costs and improve work efficiency.

[0022] 3. The present invention provides a CEP rule update method based on the Flink streaming engine. In the present invention, after the current task completes the rule update, there is no need to pause and restart. The next task can directly load the initial rules and access the event stream from the external message engine, and then update the rules of the new task without restarting in the middle, which greatly saves time and functional workflow and improves work efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] Figure 1 It is a schematic diagram of the process of the present invention;

[0024] Figure 2 The rule updating flow chart of the present invention. DETAILED DESCRIPTION

[0025] The present invention is further described in detail below in conjunction with embodiments:

[0026] Example 1

[0027] like Figure 1 As shown, the present invention provides a CEP rule updating method based on the Flink streaming engine, comprising the following steps:

[0028] Step 1: Each task loads the initial rules from an external file. The initial rules are multiple rule lists containing rule numbers and are saved in memory according to key-value pairs. In addition, the task accesses the event stream from the external message engine and performs analysis according to the loaded rules.

[0029] Step 2: Obtain the rule data that needs to be updated from the external cache or system, then broadcast it and combine it with the event stream. Each task obtains the combined stream at this operator node.

[0030] Step 3: According to the number of the update rule, compare it with the key of the operator node in step 2. If they are the same, convert this update rule into an event stream with a special mark. If there are multiple concurrent nodes at this time, it is necessary to copy multiple rule events according to the rules and set the values ​​of different specified fields. Then, deliver the event stream to the downstream operator of this task. In the rule stream, compare the update rule number with the key of the rule of the operator node to be updated. If the comparison results are inconsistent, ignore this update rule. On the other hand, in the rule stream, compare the update rule number with the key of the rule of the operator node to be updated. If the comparison results are consistent, convert this update rule into an event stream with a special mark. According to the parallelism of the downstream operator, multiple events are generated accordingly. The type field of the event is changed to the rule type, the event number is changed to the rule number, and other corresponding fields are also updated. In the whole process, the event stream delivered to the downstream operator can be directly analyzed for association, and no additional business processing is required, which can reduce costs and improve work efficiency.

[0031] Step 4: The analyzed operator node compares the numbering information and version information of the special event stream with the existing rules of this node. If they are consistent, the rule is updated and the new rule is used for real-time correlation analysis. When the event stream is delivered to the downstream operator of this task in step 3 and the event stream is an event stream with a special mark, the downstream operator in step 4 compares the event type and number with the rules used in the operator. If the type is a rule type, the operator updates the existing rules. If it is an event type, the current rules are used to analyze the event, thereby completing the update of the downstream operator node, and achieving the purpose of updating the downstream operator node by only having to go to the rule base to obtain the rule once.

[0032] In this embodiment, after the current task completes the rule update, there is no need to pause and restart. The next task can directly load the initial rules and access the event stream from the external message engine, and then update the rules of the new task without restarting in the middle, which greatly saves time and functional workflow and improves work efficiency.

[0033] Example 2

[0034] like Figure 1 As shown, the present invention provides a CEP rule updating method based on the Flink streaming engine, and the CEP rule updating method based on the Flink streaming engine also includes the following steps:

[0035] S1: At the combined flow node where the event flow and the rule flow are combined, the rule flow is updated, and the event flow is analyzed after the rule is updated;

[0036] S2: After the updated rules analyze the event stream, additional processing services are written, and the newly written processing services are used to perform correlation analysis on each event, thereby completing the rule update for all operator nodes.

[0037] In this embodiment, the task accesses the event stream from the external message engine, analyzes according to the loaded rules, obtains the rule data that needs to be updated from the external cache or system, and then broadcasts it. It only needs to go to the rule library to obtain the rules once, and at the same time converts the updated rules into a special marked event stream. According to the parallelism of the downstream operator, multiple events are generated accordingly. The type field of the event is changed to the rule type, the event number is changed to the rule number, and other corresponding fields are also updated. Then, the event stream with a special mark is delivered to the downstream operator of this task. The downstream operator compares the event type and number with the rules used in the operator. If the type is a rule type, the operator updates the existing rules. If it is an event type, the current rules are used to analyze the event, thereby completing the update of the downstream operator node, so that the rule update only needs to go to the rule library to obtain the rules once, and the purpose of updating the downstream operator nodes is achieved.

[0038] The above generally describes the present invention in detail, but it is obvious to a person skilled in the art that some modifications or improvements can be made to the present invention. Therefore, modifications or improvements that do not depart from the spirit of the present invention are within the scope of protection of the present invention.

Claims

1. A CEP rule updating method based on Flink streaming engine, characterized by: The following steps are involved: Step 1: Each task loads the initial rules from an external file and saves them in memory according to key-value pairs. In addition, the task accesses the event stream from the external message engine and analyzes it according to the loaded rules. Step 2: Obtain the rule data that needs to be updated from the external cache or system, then broadcast it and combine it with the event stream. Each task obtains the combined stream at this operator node. Step 3: Compare the update rule number with the key of the operator node in step 2. If they are the same, convert the update rule into an event stream with a special mark. If there are multiple concurrent nodes at this time, it is necessary to copy multiple rule events according to the rules, set the values ​​of different specified fields, and then deliver the event stream to the downstream operator of this task. Step 4: The operator node to be analyzed compares the number information and version information of the special event flow with the existing rules of this node. If they are consistent, the rule is updated and the new rule is used for real-time correlation analysis. The following steps are also included: S1: At the combined flow node where the event flow and the rule flow are combined, the rule flow is updated, and the event flow is analyzed after the rule is updated; S2: After the updated rules analyze the event stream, additional processing services are written, and the newly written processing services are used to perform correlation analysis on each event, thereby completing the rule update for all operator nodes; In the step 3, the update rule number in the rule flow is compared with the key of the rule of the operator node that needs to be updated. If the comparison results are inconsistent, the update rule is ignored; in the step 3, the update rule number in the rule flow is compared with the key of the rule of the operator node that needs to be updated. If the comparison results are consistent, the update rule is converted into an event stream with a special mark, and according to the parallelism of the downstream operator, multiple corresponding events are generated. If the type field of an event is changed to the rule type, the event number is changed to the rule number, and other corresponding fields are also updated; in the step 3, when the event stream is delivered to the downstream operator of this task, if the event stream is an event stream containing a special mark, in the step 4, the downstream operator compares the event type and number with the rule used in the operator. If the type is a rule type, the operator updates the existing rule; if it is an event type, the current rule is used to analyze the event.

2. According to a CEP rule updating method based on Flink streaming engine according to claim 1, it is characterized in that: The initial rules in step 1 are multiple rule lists containing rule numbers.