Communication between child and parent workflows

Recently, I had the opportunity to work with one of the application developers who was trying to pass the data between child and parent workflows. 

Objective: Successfully, pass the data between the child and parent workflows.

Solution:

Please find the attached sample to understand complete solution described below.

There are three pieces to the solution.

1) Parent Workflow Containing EventDrivenActivy[OnGetValue] which consists of HandlExternalEventActivity [hadleGetValue]. Once the event is handled, there should be an external method called to return the value.

2) ExternalDataExchange Service that implements methods and events to be raised for exchange of data.

3) Child Workflow needs to have a CallExternalMethodActivity that is called to get a value from parent workflow and is handled by the handleExternalEventActivity in parent workflow. There's a handleExternalEventActivity as well in the child workflow to handle the event raised by callExternalMethodActivity in the parent workflow to return the value.

In essence, the communication can be described as a 7-step process as shown below:

1) Call External Method from child workflow request to get data from parent.
2) Event raised by the host (ExternalDataExchange Service [EDES]) to pass the child request to parent
3) HandleExternalEvent in parent workflow handles the event raised by the EDES.
4) Call External Method from parent to send data to child.
5) Event Raised by Host (EDES) to pass the data to child.
6) HadleExternalEvent handles the event in the child workflow.
7) Child workflow uses Call External Method to inform host that it's completed.

ParentChildCommunication.zip

Comments

  • Anonymous
    June 11, 2012
    The comment has been removed