This section explains how to develop a definition file, as follows:
Create an event type definition file similar to the items of the event type definition designed previously.
Refer to "9.2.1 Event Type Definition File" for information on the format of an event type definition file.
Example
Example of an event type definition
Below is an example of an event type definition for an event in XML format.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<eventType xmlns="urn:xmlns-fujitsu-com:cspf:bdcep:v1" id="EVENTTYPE_01">
<comment>Event type definition 01</comment>
<type>XML</type>
<xmlSchema>
<![CDATA[
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns="http://dataaccesscontrol.sspf.fujitsu.com/namespace/xmlmessage"
targetNamespace="http://dataaccesscontrol.sspf.fujitsu.com/namespace/xmlmessage">
<xs:element name="messagedata">
<xs:complexType>
<xs:sequence>
<xs:element name="memberID" type="xs:string" />
<xs:element name="areaID" type="xs:string" />
<xs:element name="status" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
]]>
</xmlSchema>
<root>messagedata</root>
<useLogging>true</useLogging>
<loggingTableName>/echonet</loggingTableName>
<useCep>true</useCep>
</eventType>
Create a rule definition file similar to the items of the rule definition designed previously.
Refer to "9.2.2 Rule Definition File" for information on the format of a rule definition file.
Also assign a debug log listener (@DebugLogListener) in complex event processing rules, to check operation in an integration test. Refer to "5.5.1.2.1 Debug log listener" for information on the debug log listener.
Example
Example of a rule definition
<?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>
This example describes the following rules:
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.
Using the debug log listener allows logs for debugging to be output to the engine log when a complex event processing statement is executed.
Specifically, assign the "@DebugLogListener" annotation in front of the target complex event processing statement.
Also, using the "@Name" annotation to give a name to the target complex event processing statement at the same time will allow the output information of the engine log to be found easily.
Syntax
@Name("name")
@DebugLogListener
complexEventProcessingStatement
This is output at the same time as debug log output and allows the output information to be found easily.
If the same name is given to multiple complex event processing statements, names will be automatically assigned using a format of two hyphens (--) and a numeric will be appended to the end of each name.
This is the complex event processing statement to be the target of debug log output.
Note
The debug log listener may cause a decline in performance, so avoid use during normal business operation.
Information
If the "@Name" annotation is not specified
If the "@Name" annotation is not specified, an automatically assigned unique name such as "0b0562a2-56e7-4cf3-a520-cb1e16ef2992" will be output in place of the value of the "@Name" annotation.
Example of output when the "@Name" annotation is specified (@Name('EPL') specified)
2012-07-09 19:32:35,495 [DEBUG] EPL:length=1
EPL[0]
Example of output when the "@Name" annotation is not specified
2012-07-09 19:35:55,244 [DEBUG] 34b1785f-900c-4420-b2bf-ea53aa368b07:length=1
34b1785f-900c-4420-b2bf-ea53aa368b07[0]
Create a master definition file similar to the items of the master definition designed previously.
Refer to "9.2.3 Master Definition File" for information on the format of a master definition file.
Example
Example of a master definition
This is an example of a master definition (development asset ID: MASTER_01) where the schema file is "/var/tmp/SchemaFile01.csv" and the data file is "/var/tmp/MasterFile01.csv".
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<master xmlns="urn:xmlns-fujitsu-com:cspf:bdcep:v1" id="MASTER_01">
<comment>Master definition 01</comment>
<schemaFile>/var/tmp/SchemaFile01.csv</schemaFile>
<dataFile>/var/tmp/MasterFile01.csv</dataFile>
<skipHeader>false</skipHeader>
</master>
Create a SOAP listener definition file similar to the items of the SOAP listener definition designed previously.
Refer to "9.2.4 SOAP Listener Definition File" for information on the format of a SOAP listener definition file.
Example
Example of a SOAP listener definition
This example defines the notification of a message (event) that includes a SOAP body saying that the root element is "cep" in the user-developed Web service with the connection destination URL "http://192.168.11.249/WebServWAR/MyApp1Service".
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<soapListener xmlns="urn:xmlns-fujitsu-com:cspf:bdcep:v1" id="LISTEN_01">
<comment>SOAP listener definition 01</comment>
<url>http://192.168.11.249/WebServWAR/MyApp1Service</url>
<nameSpace>http://webservice/</nameSpace>
<prefix>ns</prefix>
<method>cep</method>
</soapListener>