This is common in integration projects to have to manage flows with variants to take into account requirements that are specific to a given source or target, for example mapping rules might differ between business units or geographies.
To avoid duplicating flows to manage each variant, a common approach is to create a generic application managing the common requirements and handling specific requirements in Dynamic Sub Processes as needed.
For example, if output files have to be written in a different format depending on the target country, it is possible to create a Sub Process for each target country, include the country code in the Sub Process name (WriteFile_FR, WriteFile_DE, WriteFile_US, etc) and then at run time call the needed Sub Process based on the country code.
This article is to explain how to call Dynamic Sub Processes in BusinessWorks and BusinessWorks Container Edition. This apply to Direct Sub Processes.
Creation of the Sub Processes
It is generally recommended to create a dummy Sub Process to define the signature that is going to be used by all the Sub Processes needed to implement the target use case, by signature I mean the Input and Output schemas.
. Create a Direct Sub Process
. Set the Input and Output Schemas as needed, the dummy Sub Process can stay empty, it will not be used at runtime
. Then Copy / Paste the dummy Sub Process has needed and use Sub Processes names that will be easy to build at runtime (a common part and a variable part)
. Finally implement the needed logic in each of the created Sub Processes
Calling Sub Processes dynamically
. Use the CallProcess activity and configure it using the dummy Sub Process created earlier
. Directly enter the XPATH code in the ‘Process Name Dynamic override’ section or create an XPATH formula using the XPATH editor
Sub Process names should be in the following format : <packagename>.<processname>
In case there are multiple levels of packages this should be in the following format : <packagename>.[<subpackage>].<processname> , for example Subs.fileout.WriteFR
for example : Subs.Sub2
Using the XPATH editor
. The activity is now configured, in the example below, depending on the value of the $code properties it will call the Sub Process Sub1 or the Sub Process Sub2
. Map the Input of the CallProcess activity as needed
Debugging the application in Studio
To debug your application in Studio it is important to make sure all the Dynamic Sub Processes are selected before starting the Debugger (it is not needed to select the dummy process).
Calling dynamically a Sub Processes located in a Shared Module
To do this the name of the Sub Process must use the following format:
<sharedmodulename>/<packagename>.<processname>
for example : MySharedModule/mysharedSubs.Sub3
Reference elements
Additional elements
A project sample is attached
Recommended Comments
There are no comments to display.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now