Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Correlation in WF 4 on workflow InstanceId

In Windows Workflow Foundation under .NET 4.0, is there a way to correlate operations based on the InstanceId (GUID) of a long-running persisted workflow?

For example:

  1. Operation 1 creates workflow instance, returns workflow instance ID to client
  2. Client may later query InstanceStore database to retrieve InstanceId from Instances view
  3. Client calls Operation 2 and passes InstanceId for content-based correlation

I can do all of this if I have the client create and pass a GUID to the first operation, use that value in content-based correlation, then promote that value when persisting. That seems redundant, though, since the workflow is already creating a GUID for the instance.

like image 310
TrueWill Avatar asked Jun 19 '26 22:06

TrueWill


1 Answers

Create an activity to retrieve the workflow instance Id from the context passed in and return this from the SendReply activity. Next use the CorrelationInitializer on the SendReply to setup the request correlation.

like image 50
Maurice Avatar answered Jun 23 '26 06:06

Maurice