In this exercise, you will add one additional route for a different warehouse code (KWA2MNW2U). You will add receivers to each route and also additional processing to show how you can vary the processing to adjust the message as required by the receiver.
For the sake of simplicity, you shall continue to send mails to each of the different receivers but with different Subject.
Each receiver could ideally have different modes of communication, like API call (via OData, HTTP, SOAP, etc.), file transfer, remote function call, IDOC, etc.
Finally, you shall convert the message to different formats like flat file and JSON for different receivers.
Step 1: Add additional routes to the router step
-
Add an End message event:
- Click on the design Palette.
- Choose Events.
- Choose End Message Event.
- Click on the connector, go to the properties sheet, General tab and rename the connector to Warehouse 2 code match.
-
Add a receiver for this route:
- Click on the design palette.
- Choose Participants.
- Choose Receiver.
- Drag the receiver on the canvas as shown below.
-
Copy the mail channel configuration:
- Now select the newly created mail channel and choose the speed button for Paste Configuration. Click yes on the confirmation pop-up.
-
Configure different mail Subject to differentiate between the mails from different routes.
- Now choose the newly created mail channel and set its subject to Mail for route KWA2MNW2U.
-
Configure the routing condition for the new warehouse code.
Field |
Value |
Expression Type |
XML |
Condition |
//orders/order/order/code = 'KWA2MNW2U' |
-
Save, deploy and execute the flow with the existing input message with the changed address field again.
Last time you executed the flow, you did not receive any mail. However, now you should be able to see the below mail with the following address:
2025 M Street,Northwest,Washington DC,20036:
Step 2: Convert message formats
Assume that the Warehouse 1 (KWA2PRBK5I) expects a CSV file and Warehouse 2 (KWA2MNW2U) expects a JSON message:
-
Covert the message for Warehouse1 to Flat file:
- Click on the design palette.
- Choose Message Transformers.
- Choose Converter.
- Choose XML to CSV Converter.
- Drag the CSV converter on the execution pipeline next to the Router step.
- Configure the following values in the XML to CSV converter:
Field |
Value |
Path to Source Element in XSD |
//orders |
Field Separator in CSV |
Comma(,) |
Include Field Name as Headers |
Checked |
Include Parent Element |
Unchecked |
Include Attribute Values |
Unchecked |
-
Covert the message for Warehouse2 to JSON:
- Click on the design palette
- Choose Message Transformers
- Choose Converter
- Choose XML to JSON Converter
- Drag the CSV converter on the execution pipeline next to the Router step.
- Leave the configure of the XML to JSON converter unchanged.
-
Save, deploy and execute the flow twice - one for each of the following address:
-
23,Prime View,Redfield,Bangalore,Karnataka,560037,India
- here you get a flat file in your email:
2025,M Street,Northwest,Washington DC,20036,USA
- here you get a JSON message in your email: