Redeemed1
Redeemed1

Reputation: 4030

WF4 receive activity to be able to CreateInstance AND handle subsequent correlation

I want to create a workflow that will be persistent and which will consist of a Pick activity containing the following:

  1. A Receive pick activity (ReceiveItem) which can Create a WF Instance using an email address parameter for correlation AND can also be called again later with the same email address and be picked up in correlation to start up the correct persisted WF. Each item is added to a queue for later processing

  2. A MaxItems pick activity which will force the processing of the queue when it reaches a defined size and

  3. A Timer pick activity which will simply process all queued items at the end of the day

Please Note: I want to receive the second and subsequent items via RecieveItem with the same email address parameter.

My question is: Will this work as I suggest or am I going to get correlation collisions because the Receive activity can CreateInstance? Or will WF simply create a WF Instance at the beginning and then always correlate after that?

If this will not work how could I implement this with one single Receive activity and still get the benefit of single workflow handling the both the receive and batch operations?

Upvotes: 2

Views: 1529

Answers (1)

Maurice
Maurice

Reputation: 27632

That will work just fine. Check this blog post for an example of how to do that. The complete XAML is listed at the bottom if you want to inspect all Receive settings.

Upvotes: 1

Related Questions