Skip to content

tutorial routes with split

Raymond Meester edited this page Mar 23, 2023 · 19 revisions

In the previous tuturial we created a simple route. In this tutorial you learn how to create multiple routes with queues and a split.

Step 1: Create a route

  • On the flows page click on "Actions" button and then "Create route".
  • Give the flow the name: "ComplexRoute".

Step 2: Configure the inbound route

  • On the first route step, create a "New route" (Blue button).
  • Name the route "InboundXML".
  • Add the following XML in the XML Editor:
<route>
    <from uri="sjms:TestQ1"/>
    <log message="Message received"/>
    <to uri="direct:split"/>
</route>
  • Save the route.

  • Choose "Add" --> "Connection"

  • Select connection "EmbeddedBroker"

Note: The connection was created in an earlier tutorial. Check this tutorial on message queueing if the connection isn't selectable.

Step 3: Configure the split route

  • Choose "Add" --> "Route" .
  • On the new steps choose "New route" (Blue button).
  • Name the route "SplitXML".
  • Add the following XML in the XML Editor:
<route>
    <from uri="direct:split"/>
    <split>
        <xpath>//names/name</xpath>
        <to uri="direct:outbound"/>
    </split>
</route>
  • Save the route.

Step 4: Configure the outbound route

  • Choose "Add" --> "Route"
  • On the new step create a "New route" (Blue button).
  • Name the route "OutboundXML".
  • Add the following XML in the XML Editor:
<route>
    <from uri="direct:outbound"/>
    <log message="Outbound XML"/>
    <to uri="sjms:TestQ2"/>
</route>
  • Save the route.

  • Choose "Add" --> "Connection"

  • Select connection "EmbeddedBroker"

Note: The connection was created in an earlier tutorial. Check this tutorial on message queueing if the connection isn't selectable.

  • Save the flow.

Step 4: Start flow and broker

  • Make sure the broker is running (Go to Broker --> Manage to check if the broker is started).
  • Start the flow "ComplexRoute" on the Flows manage page.

Note: Queues are automatically generated. However you can also go to the 'Broker --> Queues' page and create the queues manually.

Step 5: Test the flow

  • Go to Broker --> Queues --> TestQ1 --> Send.
  • Paste the following XML:
<names>
    <name>
       <firstname>John</firstname>
       <lastname>Doe</lastname>
    </name>
    <name>
       <firstname>Michael</firstname>
       <lastname>Kay</lastname>
    </name>
    <name>
       <firstname>Jane</firstname>
       <lastname>Smith</lastname>
    </name>
</names>

SendMessage

  • Send the XML (Actions --> Send and Return).

Result are three files on TestQ2 (The Queues page is refreshed every 5 seconds). Browse the queue to see the individual messages.

BrowseMessages


You can continue to the next tutorial to find out how to run flows in alternative ways (outside using the user interface which we done so far).

Clone this wiki locally