Workflow services correlation

1.3k Views Asked by At

I would like to implement next workflow scenario: enter image description here
I have workflow service with two branches. Operation2 (Receive activity) is correlated with CorrelationHandle “handle2” which is initialized from message header.

enter image description here

The flow is next:

1) Someone calls Operation1 and it initializes correlation handler for Operation2. So the case is that correlation value for Operation2 is not the same as for Operation1 and should be obtained in runtime when execution Operation1.
2) Using correlation value client may call Operation2.
3) If correlation is not correct Operation2 should still be executed but with custom logic.

The problem is when I call the first service I get an exception:

The CorrelationHandle is already in use with BookmarkScope '{bookmark scope id x} ', so it cannot be used with BookmarkScope '{bookmark scope id y}'



Debugging shows that even if I call Operation1 only “handle2” from Operation2 is also initialized with some value in Receive2 activity!!! so I it seems I cannot re-initialize it.

Any ideas how it can be fixed?

UPDATE:

I have attached file with source code so you may reproduce the issue. Just launch Operation1.

http://dl.dropbox.com/u/27847776/WorkflowCorrelation.zip

Thanks beforehand,

-Petro

2

There are 2 best solutions below

0
On

Do't use Pick. Use Parallel and set the parallel to terminate only when you are sure the conversation has ended. The Parallel has a property where you can set the terminate condition.

0
On

In my experience you cannot re-initialize a correlation handle. You would need to create a separate correlation handle for each key you want to correlate on.