...
Anchor |
---|
| _Toc383101859 |
---|
| _Toc383101859 |
---|
|
Objective
To route the incoming messages to different destinations based on the content of the messages.
Anchor |
---|
| _Toc383101860 |
---|
| _Toc383101860 |
---|
|
Prerequisites
- Start Fiorano Enterprise Server (FES) and Fiorano Peer Server (FPS).
- Login Log on to the eStudio application.
- Understand the basic menus and perspectives (panels) in the eStudio application.
Anchor |
---|
| _Toc383101861 |
---|
| _Toc383101861 |
---|
|
Scenario
Send data using the Feeder and filter the books whose where the publisher is 'Methi' by using CBR. Whenever When the publisher value matches 'Methi', only then the data is sent to display1, or else it is sent to display2.
Anchor |
---|
| _Toc383101862 |
---|
| _Toc383101862 |
---|
|
Components Used
- One CBR component component.
- One Feeder component to send the books data.
- Two Display components , - one for showing the filtered data and the other for showing the raw data sent.
Anchor |
---|
| _Toc383101863 |
---|
| _Toc383101863 |
---|
|
How CBR works
The CBR component creates a port for the XPath expression specified and the messages satisfying the particular XPath is are sent onto the to their respective portports. In addition to these ports, an output port 'OUT_FALSE' is created and messages whose content does not satisfy any of the XPath expressions will be are sent through to this port. If more than one XPath condition is true, the message is sent on all the ports for which the XPath condition evaluates to true.
Anchor |
---|
| _Toc383101864 |
---|
| _Toc383101864 |
---|
|
Setting up the Example Application Anchor |
---|
| _Toc383101865 |
---|
| _Toc383101865 |
---|
|
Configuring the CBR componentTo configure CBR, perform the following actions in eStudio:
- Add a new Event Process with the name 'CBR_Example'.
- Drag the CBR component present under the Flow category in the Micro Service Palette to the Fiorano Orchestration Editor.
Figure 1: Adding CBR component to Fiorano Orchestrator
Double-click the CBR component to open the Configuration Property Sheet (CPS) and use a valid Schema in the Schema editor.
Expand |
---|
title | For the pesent example, copy this Schema and paste in the Schema editor. |
---|
|
<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.books.org"
xmlns="http://www.books.org"
elementFormDefault="qualified">
<xsd:element name="BookStore">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="Book" minOccurs="1" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="Book">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="Title" minOccurs="1" maxOccurs="1"/>
<xsd:element ref="Author" minOccurs="1" maxOccurs="1"/>
<xsd:element ref="Date" minOccurs="1" maxOccurs="1"/>
<xsd:element ref="ISBN" minOccurs="1" maxOccurs="1"/>
<xsd:element ref="Publisher" minOccurs="1" maxOccurs="1"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="Title" type="xsd:string"/>
<xsd:element name="Author" type="xsd:string"/>
<xsd:element name="Date" type="xsd:string"/>
<xsd:element name="ISBN" type="xsd:string"/>
<xsd:element name="Publisher" type="xsd:string"/>
</xsd:schema>
|
Figure 2: Adding Schema to CBR component
- Click the Ellipsis button present in the bottom-right part. In the Root Element dialog box, select 'BookStore' and click OK. The root element will appear within Select Root Element brackets present next to the Ellipsis button.
Figure 3: Selecting Root element
- Click Next twice (As as Schema section lists all the namespace prefixes used by XML schema, leave do not make any changes to the Namespaces section without any changes).
- In the Routing Rules section, click the cell under XPath and click the Ellipsis button next to it.
Figure 4: Configuring XPath
- In the Set XPath window, perform the following actions to specify the Xpath for the purpose of filtering the data of books where the books whose publisher is 'Methi':
- Drag the Publisher element present under the Document tab in the left pane to the editor on the right side.
- Right-click inside the editor, point to AddConstant and click the StringValue option
Figure 5: Adding the String Value
- In the Customize String Literal dialog box, type the text 'Methi' and click OK.
Figure 6: Providing the name of the publisher name
- Click the Palette tab in the left pane, double-click the StringFunctions and drag the compare function to the editor.
Connect the Publisher element (drag from R output node) to the first element in Compare function and similarly connect the Methi element to the second element in Compare function.
toconsiderPublisherelementascomparefunction'sfirstargumentandconstantvalue'Methi'asthefunction'ssecondto consider Publisher element as Compare function's first argument and Constant value 'Methi' as the function's second argument. |
Image Modified
Figure 7: Providing input values to the String Compare function
- Drag the equals(=) function from the Operators category.
- Right-click inside the editor, go to Add Constant and click the Numeric Value. In Customize Numeric Value, type '0' (zero) to add the '0' element. Click OK.
- Connect compare function's output to the first argument of the Equals (=) operator and constant '0' to the second argument of the Equals operator, and click OK.
Figure 8: Checking the publisher name to match with 'Methi'
- First The first row of the Routing rules will be populated with the configured data. Click Next twice and then click Finish. Two output ports appear in the CBR component present in the Fiorano Orchestrator:
- OUT_XPATH: To send the messages those that satisfy the specified XPath.
- OUT_FALSE: To send messages whose content does not satisfy the XPath expressions specified.
Figure 9: Output ports generated after CBR configuration
Anchor |
---|
| _Toc383101866 |
---|
| _Toc383101866 |
---|
|
Composing the Event Process
To work with the 'CBR_Example', compose the event process by doing performing the following actions.
- Drag one Feeder component present under the Util category in the Service Palette to the Fiorano Orchestrator and connect the output port of Feeder1 to the CBR input port.
- Configure Feeder component by performing the following actions:
- Click Connected Port Schemas, select IN_PORT in the Connected ports dialog box and click OK, and then click Next.
- In the Message Details Configuration dialog box, click Generate Sample, make change the max value under No. of Repeatable elements to be generated to '1' and click OK.
- Click Validate, click OK on the Validation Successful dialog box and click Finish.
- Drag two Display components present under the Util category and connect the ports in the as mentioned below fashion:
- Output port 'OUT_FALSE' of the CBR component to input port of Display1
- Output port 'OUT_XPATH' of the CBR component to input port of Display2. Rename (press F2) this Display to "FilteredDisplay" to identify filtered messages.
Figure 10: CBR component with the Display components and the Feeder connected
Anchor |
---|
| _Toc383101867 |
---|
| _Toc383101867 |
---|
|
Running the Event Process
To run the 'CBR_Example' event process, perform the following actions:
- Click the Check Resource and Connectivity icon (or press ALT+SHIFT+C) to check the resource and its connectivity.
- Click the Run Event Process icon (ALT+SHIFT+R) to run the event process. Two Display windows and one Feeder window will appearare displayed.
- Open the Feeder window and click Send without making any changes.
Figure 11: Sending the message without changing the data
- The message without filtering appears unfiltered message gets displayed in Display1 window.
Figure 12: Message appearing displayed in Display1 as when data does not match the filter condition
- Open the Feeder window, replace the text "Publisher" with an existing publisher name—"Methi" and click Send.
Figure 13: Sending a Message with the keyword (publisher name) to filter
- The filtered message appears gets displayed in the FilteredDisplay window.
Figure 14: Message appearing displayed in the FilteredDisplay window as when data matches the filter condition
...
- Download CBR_Example event process and import it to the Event Process Repository in the Server Explorer in eStudio to understand the configuration used in this example and to execute the working sample.
- Please note that the options used in this example are minimum, which helps you to get an overview of assists in getting familiar with the application. To explore the other options present in the CBR, Feeder and Display, refer sections: CBR, Feeder and Display respectively.