Contents

Objective

To route the incoming messages to different destinations based on the content of the messages.

Prerequisites

  1. Start Fiorano Enterprise Server (FES) and Fiorano Peer Server (FPS).
  2. Login to eStudio application.
  3. Understand the basic menus and perspectives (panels) in eStudio application.

Scenario

Send data using Feeder and filter the books whose publisher is 'Methi' by using CBR. Whenever the publisher value matches 'Methi', only then the data is sent to display1, or else to display2.

Components Used

  • CBR component.
  • One Feeder component to send the books data.
  • Two Display components, one for showing the filtered data and other for showing the raw data sent.

How CBR works

CBR component creates a port for the XPath expression specified and the messages satisfying the particular XPath is sent onto the respective port. 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 sent through 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.

Setting up the Example

Configuring CBR component

To configure CBR, perform the following actions in eStudio:

  1. Add a new Event Process with the name 'CBR_Example'.
  2. 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
     
  3. Double-click the CBR component to open the Configuration Property Sheet (CPS) and use a valid Schema in the Schema editor.

     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
     

  4. 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
     
  5. Click Next twice (As Schema section lists all the namespace prefixes used by XML schema, leave Namespaces section without any changes).
  6. In the Routing Rules section, click the cell under XPath and click the Ellipsis button next to it.


    Figure 4: Configuring XPath
     
  7. In the Set XPath window, perform the following actions to specify the Xpath for filtering the data of the books whose publisher is 'Methi':
    1. Drag the Publisher element present under Document tab in the left pane to the editor on the right.
    2. Right-click inside the editor, point to AddConstant and click StringValue option


      Figure 5: Adding String Value
       
    3. In the Customize String Literal dialog box, type the text 'Methi' and click OK.


      Figure 6: Providing publisher name
       
    4. Click the Palette tab in the left pane, double-click StringFunctions and drag compare function to the editor.
    5. Connect the Publisher element (drag from R output node) to the first element in Compare function and similarly connect Methi element to the second element in Compare function.
      This is toconsiderPublisherelementascomparefunction'sfirstargumentandconstantvalue'Methi'asthefunction'ssecondargument.


      Figure 7: Providing input values to the String Compare function
       
    6. Drag equals(=) function from Operators category.
    7. Right-click inside the editor, go to Add Constant and click Numeric Value. In Customize Numeric Value, type '0' (zero) to add '0' element. Click OK.
    8. Connect compare function's output to the first argument of 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'
       
  8. First row of Routing rules will be populated with the configured data. Click Next twice and then click Finish. Two output ports appear in CBR component present in the Fiorano Orchestrator:
    1. OUT_XPATH: To send the messages those satisfy the specified XPath.
    2. OUT_FALSE: To send messages whose content does not satisfy the XPath expressions specified.


      Figure 9: Output ports generated after CBR configuration

Composing the Event Process

To work with 'CBR_Example', compose the event process by doing the following actions.

  1. Drag one Feeder component present under Util category in the Service Palette to the Fiorano Orchestrator and connect the output port of Feeder1 to CBR input port.
  2. Configure Feeder component by performing the following actions:
    1. Click Connected Port Schemas, select IN_PORT in Connected ports dialog box and click OK, and then click Next.
    2. In the Message Details Configuration dialog box, click Generate Sample, make max value under No. of Repeatable elements to be generated to '1' and click OK.
    3. Click Validate, click OK on Validation Successful dialog box and click Finish.
  3. Drag two Display components present under Util category and connect the ports in the below fashion:
    1. Output port 'OUT_FALSE' of CBR component to input port of Display1
    2. Output port 'OUT_XPATH' of CBR component to input port of Display2.


      Figure 10: CBR component with Display components and Feeder connected

Running the Event Process

To run 'CBR_Example' event process, perform the following actions:

  1. Click Check Resource and Connectivity icon (or press ALT+SHIFT+C) to check resource and connectivity.
  2. Click Run Event Process icon (ALT+SHIFT+R) to run the event process. Two Display windows and one Feeder window will appear.
  3. Open Feeder window and click Send without making any changes.


    Figure 11: Sending message without changing the data
     
  4. The message without filtering appears in Display1 window.


    Figure 12: Message appearing in Display1 as data does not match the filter condition
     
  5. Open Feeder window, replace the text 'Publisher' with 'Methi' and click Send.


    Figure 13: Sending Message with the keyword (publisher name) to filter
     
  6. The filtered message appears in Display2.


    Figure 14: Message appearing in Display2 as data matches the filter condition

Reference

  • Please note that the options used in this example are minimum, which helps you to get an overview of the application. To explore the other options present in the CBR, Feeder and Display, refer sections: CBRFeeder and Display respectively.
Adaptavist ThemeBuilder EngineAtlassian Confluence