This section explains the setup file for describing a rule definition (rule definition file).
The rule definition file is an XML file that has "rule" as the root element. The rule definition file describes the rules for the high-speed filter and complex event processing.
The items to be set in the rule definition file are shown below:
Element or attribute | Item name | Explanation | Allowed values | Mandatory/ |
---|---|---|---|---|
id (attribute of "rule") | Development asset ID | ID unique in the deployment CEP engine. | Up to 39 alphanumeric characters, underscores (_), or hyphens (-). Note: The first character must be a letter. | Mandatory |
comment | Comment | Explanation of this definition. | Up to 1,000 characters. | Optional |
filter | Filter rule | Description of a high-speed filter rule. Use a method such as a CDATA section if any part of the description can be interpreted as a markup specification. | Up to 1,048,576 characters. | (*1) |
statements | Complex event processing rule | Description of a complex event processing rule. Use a method such as a CDATA section if any part of the description can be interpreted as a markup specification. | Up to 1,048,576 characters. | (*2) |
*1: Mandatory if a high-speed filter rule is to be described.
*2: Mandatory if a complex event processing rule is to be described.
Point
Filter rule options (such as "SkipChar", which specifies strings to be excluded as search targets), must be described at the beginning of the filter rule (refer to Chapter 2, "Filter Rule Language Reference" in the Developer's Reference for information on filter rule options).
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<rule xmlns="urn:xmlns-fujitsu-com:cspf:bdcep:v1" id="RULE_02">
<comment>Rule definition_02</comment>
<filter>
<![CDATA[
@SkipChar("\n")
@SeparateChar("\t")
@ANKmix(true)
@KNJmix(true)
on EVENTTYPE_02 {
(...)
}
]]>
</filter>
</rule>
A huge number of rules can be described in a single rule definition (as long as the number of characters is not exceeded), but when rules become complex, this can negatively affect their ability to be maintained and referenced. When creating rule definitions, consider creating separate rule definitions for the high-speed filter and for complex event processing, and dividing rule definitions into smaller ones that are meaningful and cohesive.
Note
Up to 32 rule definitions can be deployed to one CEP engine.
When using cepgetrsc to display details of the development asset, the displayed filter rules and complex event processing rules use the same format as used by the CDATA section.
See
Refer to Chapter 2, "Filter Rule Language Reference" in the Developer's Reference for information on how to describe filter rules.
Refer to Chapter 1, "Complex Event Processing Language Reference" in the Developer's Reference for information on how to describe complex event processing rules.
Example
Description example
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<rule xmlns="urn:xmlns-fujitsu-com:cspf:bdcep:v1" id="RULE_01">
<comment>Rule definition_01</comment>
<filter>
<![CDATA[
on EVENTTYPE_01 {
if ($status == 'Walking') then output() as EVENTTYPE_01;
}
]]>
</filter>
<statements>
<![CDATA[
@SoapListener('LISTEN_01')
@DebugLogListener
select * from EVENTTYPE_01 where areaID = '1010';
]]>
</statements>
</rule>
In this example, the rules shown below are described.
If the status item contents (string) extracted from the "EVENTTYPE_01" event type input event is "Walking", it is transferred to Complex Event Processing.
This rule notifies the SOAP listener of event data with the "EVENTTYPE_01" event type, and simultaneously outputs debug information to the engine log.