Managing and Synchronizing Parent/Child Workflows in appRules®

Time to share more implementation tips and tricks. This time, we will share ideas on how th manage and synchronize jobs instantiated by a parent job.

 

You can launch child workfows from any running workflow in appRules in the following ways:

  1. Custom Function

You can use the App.ExecuteWorkflow() method in a custom function to launch a child workflow.

 

  1. ExecuteWorkflow Activity

You can add and configure an ExecuteWork activity anywhere in your workflow to launch a child workflow

 

  1. SplitFile Activity

When a SplitFile workflow activity is used to split a file, it can also launch a child workflow to process the records in the files.

 

  1. WatchFileSystem Activity

When a WatchFileSystem workflow activity is used to implement a file watcher (file drop) solution, it can also launch a child workflow to process the records in the files.

 

  1. Target DataManager

You can configure the HighPerformance property of some Target activities to process records in batches.  A child workflow can be launched to process records in each batch.

 

 

If the child workflows are launched as separate processes (asynchronous), there is the possibility that they will still be running when the parent workflow is completed.   Depending on the project, it may not be a big deal to have child workflows running while the parent  is no longer running.  But for other projects, there is a need to synchronize the running of the child workflows with the parent workflow.    Depending on the project, you may want to relate the child workflows to the parent, while in other projects, it is not as important to relate child and parent workflows.  Tying child workflows to their parent allows you to easily navigate to them while viewing Project  Run Details.

 

Relating Parent and Child Workflows

When a child workflow is launched, unless it is tied to the parent workflow, it is free to start and run without any link to the parent.  In that case, no parent relationship information is captured and stored for the child workflow.   To related a child workflow to a parent, the parent workflow information must be passed as arguments to the child workflow.  The arguments must be defined as follows in the child workflow:

When a child workflow is launched from a SplitFile activity or from a Target activity, the arguments are automatically passed to the child workflow.  If the ProjectId and ProjectInstanceId of the parent workflow are not included in the argument list, the child workflow will not be launched successfully.

When a child workflow is launched from a custom function or from an  ExecuteWorkflow activity, the arguments must be specified in the parameters list as follows:

Synchronizing Parent and Child Workflows

If for some reason your parent workflow needs to wait for child workflows to complete, you can add a While activity with a condition to implement a check-and-delay loop:

To wait for the child workflows to finish, set the Duration property of the Delay activity to the amount of time you wish to wait before checking again to see if the child jobs are done.

Conclusion

appRules includes several options for managing and synchronizing parent/child processes.  Select the option that works best for you to optimize processing and capture the necessary reporting details.

You can download appRules with sample projects at: http://www.appstrategy.com/appRulesTrial

 

 

Extend Data Integration & Business Rules Projects Using Custom Functions

We are constantly mentioning the fact that appRules is the most powerful no-code engine for composing integration and business rules solutions.  But that does not mean that appRules does not have the capability to integrate code in all forms when you need it.  To the contrary, appRules includes easy-to-use facilities throughout the engine to extend your workflows using custom functions and expressions.

 

The App Object

Since we are talking code, we must discuss the App object which is the most widely used object in appRules.

App is automatically added and scoped to the main (top) Sequence when you create a new project in appRules.

Expressions

You can access the methods and properties of the App object directly.  The designer will accept conditions directly from the App object. This allows you to enter condition expressions such as App.Result, App.IsActionResultValid(), etc. while composing your workflow.

Below is an example of using a method from the App object in the If activity:

Custom Functions

The Custom Function Editor is used for adding custom functions to appRules projects.  Code can be added using either C# or VB.  As in expressions, App exposes the methods and properties of the workflow to your function.   The Custom Function Editor also supports intellisence for browsing the methods and objects.

Unlike typical development environments, you do not have to worry about compiling your code and referencing the assembly.  Once validated, appRules takes care of compiling the code as needed.

Below is the appRules Custom Function Editor window:

Conclusion

Long story short, appRules – (the no-code engine) supports serious code when you need it.  It uses familiar languages and objects giving you full access to .NET.   This allows you to reuse existing code in your organization thereby saving money and completing projects much faster.

You can download appRules with sample projects at: http://www.appstrategy.com/appRulesTrial