Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Anchor
_Toc383101859
_Toc383101859
Objective

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

Anchor
_Toc383101860
_Toc383101860
Prerequisites

  1. Start Fiorano Enterprise Server (FES) and Fiorano Peer Server (FPS).
  2. Login Log on to the eStudio application.
  3. 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 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.

    Expand
    titleFor 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 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).
  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 the purpose of filtering the data of books where the books whose publisher is 'Methi':
    1. Drag the Publisher element present under the Document tab in the left pane to the editor on the right side.
    2. Right-click inside the editor, point to AddConstant and click the StringValue option


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


      Figure 6: Providing the name of the publisher name
       
    4. Click the Palette tab in the left pane, double-click the StringFunctions and drag the 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 the Methi element to the second element in Compare function.

      Info

      This is

      toconsiderPublisherelementascomparefunction'sfirstargumentandconstantvalue'Methi'asthefunction'ssecond

      to 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
       

    6. Drag the equals(=) function from the Operators category.
    7. 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.
    8. 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'
       
  8. 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:
    1. OUT_XPATH: To send the messages those that 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

Anchor
_Toc383101866
_Toc383101866
Composing the Event Process

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

  1. 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.
  2. Configure Feeder component by performing the following actions:
    1. Click Connected Port Schemas, select IN_PORT in the Connected ports dialog box and click OK, and then click Next.
    2. 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.
    3. Click Validate, click OK on the Validation Successful dialog box and click Finish.
  3. Drag two Display components present under the Util category and connect the ports in the as mentioned below fashion:
    1. Output port 'OUT_FALSE' of the CBR component to input port of Display1
    2. 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:

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


    Figure 11: Sending the message without changing the data
     
  4. 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
     
  5. 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
     
  6. 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: CBRFeeder and Display respectively.
Adaptavist ThemeBuilder EngineAtlassian Confluence