The Problem SolverWIndows Workflow Foundation
HomeShow ChangesEditPrintRecent ChangesSubscriptionsLost and FoundFind ReferencesRename

Search

History

17-11-2008 16:50:129-11-2008 12:27:562-11-2008 20:24:165-9-2008 14:11:043-9-2008 07:49:43

List all versions

Work Batch
.
Summary

Both a WorkBatch and TransactionScopeActivity can be used to do transactional work in a workflow. The difference is that the TransactionScopeActivity commits all work as soon as the TransactionScopeActivity is finished while a WorkBatch saves all items to commit and only commits them when the workflow runtime determines there is a CommitPoint. Batching also uses a TransactionScope so both are transactional.

So what is the difference. Suppose your workflow doest some stuff, is unloaded into the persistence store, continues executing, starts an TransactionScopeActivity, doest some work, terminates the TransactionScopeActivity and then before the workflow is finished or persisted again has the runtime crash on it.

Now the transaction has completed and is committed but the state of the workflow is still as it was last persisted, ie before the TransactionScopeActivity was executed. Suppose the runtime is restarted, it will detect and reload the workflow and continue from the unloaded point so do the TransactionScopeActivity again.

Now if you use a WorkBatch to commit the data things work a little different. The WorkBatch is committed in a TransactionScope but this will include the WorkflowPersistenceService itself. So if the workflow runtime crashes before the batch is committed no work is saved at all and everything can safely be repeated. If on the other hand the batch is saved and the workflow runtime crashes after that the workflow will be restarted from the second time it was saved and not repeat the work done.

A WorkBatch uses the IPendingWork interface to allow a service to commit work items.

Wiki Usage

This wiki site is supposed to be a shared resource. As a shared resource everyone is encouraged to add new content or modify existing content!

Enjoy the WF wiki.

Recent Topics

  • WorkBatch