How do I use Correlation in WF4 StateFlow (Platform Update 1)
I have a WF Service (CustomerProvisioningService) that receives a Request message and immediately runs up a StateFlow 开发者_Go百科(CustomerProvisioningStateFlow) and which is marked as CanCreateInstance.
The first State in the flow has a Sequential flow as its Entry activity which is a long running work flow with its own Send and ReceiveReply pattern to call out and receive extra information(ProvisionCustomerActivityFlow). This workflow CanCreateInstance too.
I presume for the sequential flow I need to manage correlation based on Content (CustomerId) and in this way I can identify the persisted workflow in the underlying AppFabric sql persistence.
Subsequently I have other operations in the StateFlow which are represented by WCF Service calls similar to :
SuspendCustomer(string customerId)
I am assuming that I need to pick up the correct StateFlow instance by correlating with the CustomerId in the StateFlow but I can find no way to apply Correlation in the StateFlow, neither by adding CorrelationInitializers nor referencing a local CorrelationHandle variable.
Now I am questioning if I need correlation on the StateFlow and if so how do I do it? Or am I misunderstanding something here?
Many thanks
Brian
You need to setup request message correlation to route messages to the same workflow instance. I have an example on my blog here about how to set this up. The example uses a Sequence but the process is the same with a state machine.
精彩评论