Creating a Content Based Routing Process flow

In this example we will create a Content Based Routing process flow that does the following:

1. The Parent Flow (or a Control flow) checks the content of a file and based on the type of content it will call a particular sub-flow.
2. A Sub-flow that is called by the parent flow will execute and generate the results.

Here we will use a Purchase Order XML source file and within this file there's a PurchaseOrderID element. The format of the value in this element has this format 'AA-xxxx', such as 'AA-8993', 'XY-84232', 'GH-2313' etc.

We need to look at the first two characters of the incoming value and then, if it is AA we will call sub-flow that process AA file, if it is XY then the sub-flow that handles XY will be called and so on.

We can extrapolate further from this example and apply similar logic where based on a file name or some other content we can determine which sub-process to call.

The purpose of this example is to show how to build a process like this without writing any code.

Attached document shows a step by step example of how to setup a typical Content Based Routing process.

You can extend this example where you can also dynamically set the Source, Schema, Mapping, and Target activity of the sub-process based on the routing table look up in Parent Flow's Mapping activity. You can send the entity IDs of these objects to the sub-process by using the SetChildContext function in the Parent Flow.

Refer to application's Help guide or search in this forum on how to use SetChildContext function.


Here's another example of a Content Based Routing or Dynamic Process Flow.

We can have a FTP Source (with eventContextEnabled) that receives data file and the actual file location from the FTP Trigger. Based on the FilePath (i.e., where the file is dropped) we do a lookup into a reference table and determine the related Source Schema, Mapping and the Target activities. The Lookup provides us with the Entity ID information which we then dynamically assign to the placeholder 'dummy activities' in the flow.

One of the key object in this flow is the custom plugin that has the code to grab the incoming file path and then use this path to do a look-up into a reference table. This code is also attached along with the process flow XML.



Here's another example of how dynamic lookups in process flow are used in content based routing.


Have more questions? Submit a request


Article is closed for comments.