Sukasom C.

October 20, 2008

Curious about the Correlation example in Microsoft Windows Workflow Foundation Step by Step book

I had read the Microsoft Windows Workflow Foundation Step by Step book.  Overall, it is a good reference book.

 

However, I am not quite sure about the application example illustrated in the Microsoft Windows Workflow Foundation Step by Step book in “External Data Communication” section. The example may not illustrate the true purpose of using the correlation parameter.

The example is about a process of a truck. One workflow has only one truck. There could be many workflows in the system. Each workflow has one truck ID. A truck ID is part of the correlation parameter. 

Perhaps, I am wrong. It seems to me that the application try to use the truck ID to differentiate different workflows, so the runtime could send the message to the correct workflow.  I think that the runtime uses Guid which is a workflow instance ID stored in the EventArgs object. The EventArgs is created when the runtime fires an event to the workflow. This Guid is used to differentiate between different workflows, but not the correlation parameter.

Activities in the same conversation are chained together through the value of the correlation parameter.  A better example of using the correlation parameter could be that there are many tasks running parallel in a workflow. Note, this example could be found in my previous blog, “Communication Between Inside And Outside Of A Workfow In Windows Workflow.” Each task sends a request and waits for response. Each task has uniquely Task ID. The response sent by task 1 would go back to task 1. The response sent by task 2 would go back to task 2. In this case, there are two values of Task ID which are 1 and 2. The example found in the book simply has  only one Truck ID for the whole workflow which is not make sense.

I think that the objective of the correlation parameter is to bring back an event from outside to the correct activity in a workflow, not to bring back an event to the correct workflow.

No Comments Yet »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a comment

Blog at WordPress.com.