views:

29

answers:

1

Hi,

I am trying to do a single instance workflow with WF4 and AppFabric. I want just one instance of a workflow running in the cluster.

I have tried a biztalk style: a method (CallService()) that creates the instance, and the same method in other receive activity (CallService()) that do not have the cancreateinstance checked. (I think I could correlate it through the xpath to the action in the soap message, but lets forget about correlating at this step).

My problem is that WF always creates the instance and does not correlate in the second call.

Do you know how to solve it? I would like to priorize the correlation against the creation of the instances. Any other way to do it?

Thanks in advance.

A: 

I have found the solution. Here is what I have written about: http://pablocastilla.wordpress.com/2010/10/09/single-instance-of-a-workflow-in-the-cluster-with-wf-4-0-and-appfabric/

How can we receive the messages with the same instance? Is easy making a little trick in the receive shape:

  1. We create a correlation handler. Let’s call it singleIntanceHandler
  2. In the receive shape set the CorrelatesWith property with the singleInstanceHandler.
  3. In the CorrelatesOn definition you should insert a string, not an xpath expression. For instance: “asdf”.
  4. Leave the correlation initializer just with the handle for the response.

As I understand the first time it creates the instance initializating the correlation with “asdf”, the next time it receives a message, AppFabric looks if there is an instance that he could correlate with the string “asdf”, and it finds the one initialize in the first call.

Pablo Castilla