Skip to Content

Add Conditional Routing to Your Integration Flow

test
0 %
Add Conditional Routing to Your Integration Flow
Details

Add Conditional Routing to Your Integration Flow

2019-12-17
Check the value of an element and pursue different routes of processing with independent logic.

You will learn

  • How to add conditional routing in an integration flow
  • How to define routing conditions
  • How to define routing conditions based on message content
  • How to configure multiple routes in your integration flow

Lets us check the value of the code retrieved in the previous exercise to define how the purchase order needs to be processed.

In this exercise, we terminate the processing in case we receive anything apart from KWA2PRBK5I.


Step 1: Add conditional processing
  1. Add a router step to the integration flow:

    • Click on the design Palette.
    • Choose Message Routing.
    • Choose Router.
    Choose Router
    • Drag it on to the execution pipeline after the Content Enricher step.
    Add Router
    • Add the existing connectors as shown in the picture below:
    Adjust Connectors
  2. Add an additional End event:

    • Click on the design Palette.
    • Choose Events.
    • Choose End Event.
    Choose End Message
    • Drag it on to the execution pipeline next to the Router step.
    Drag End Message
  3. Define the default route:

    • Connect the router step to the newly added End Event.
    • Click on the connector, go to the properties sheet, General tab and rename the step to No warehouse code match.
    Connector Rename
    • Click on the connector, go to the properties sheet, Processing tab and choose Default Route:
    DefaultRoute
  4. Configure the routing condition for correct warehouse code.

    • Click on the connector between the Router and the End Message Event.
    • Click on the connector, go to the properties sheet, General tab and rename the step to Warehouse code match.
    Connector Rename
    • Click on the connector, go to the properties sheet, Processing tab and add the following:
    Field Value
    Expression Type XML
    Condition //orders/order/order/code = 'KWA2PRBK5I'
    Route configuration
  5. Save, deploy and execute the flow with the existing input message.

  6. Check the mail received:

    You should have received the following mail:

    Content Enricher Mail
  7. Now change the input message by changing the value of the address field in the input message.

    Change the address to 2025,M Street,Northwest,Washington DC,20036,USA in Postman and execute the flow again.

    You should not receive any mail. This indicates that the processing took the default route because the warehouse code generated from the new address is not KWA2PRBK5I.

Which process step will you use to add conditional processing your integration flow?
×

Next Steps

Back to top