Forum post about Persistence, IEventActivity, Transactions, and Correlation
There was a great set of questions that showed up on the forum the other day and I've finally gotten around to answering them all. I was planning on posting the answers in this blog, but instead I'll just reference back to the forum post.
* What is persisted with a workflow instance and what state am I in after a computer crash?
Queues, the internal list of scheduled items, and the binary serialization of the workflow tree are all persisted. Reloading an instance after a workflow crashes gives you the exact state you had at the last persistence point.
* I want a single activity which delegates work out to the host and then waits for notification that the work is done. Should I use the ExternalDataExchangeService or a custom IEventActivity?
If it must be a single activity then I would recommend a custom IEventActivity to enable use of the solution in the StateMachine and in EventDrivens in general. This is a prime scenario for ExternalDataExchangeService, but the requirement for a single activity to do the work makes that a less than viable solution.
* How do I get persistence of the workflow to take part in the same transaction as cleanup of a database caused by an inbound event?
Batching is your friend ... see the post for details of batching.
* What are the implications of dropping correlation from the Correlated Service Sample?
In short, if you drop correlation you will risk getting a runtime exception. If two activities are waiting on the same event at the same time then we will throw an exception when the second activity tries to "handle" the already handled message.