Navigation

Search

Categories

On this page

Archive

Blogroll

Disclaimer
None - these are my opinions and they're also my employer's!

RSS 2.0 | Atom 1.0 | CDF

Send mail to the author(s) E-mail

Total Posts: 14
This Year: 0
This Month: 0
This Week: 0
Comments: 15

Sign In

 Monday, November 27, 2006
Tuesday, November 28, 2006 12:12:41 AM (Mountain Standard Time, UTC-07:00) ( )

Well, it's kind of a hack but it works.  If your workflow runtime host goes away for whatever reason, whether it be ASP.NET, a Forms or Console application, or a Windows service you can peer into the persistence database using the LoadExpiredTimerWorkflowIds method on the SqlWorkflowPersistenceService instance associated with your runtime.  The code snippet below gets the persistence service instance from the runtime and resumes the processing on each workflow.  This allows the timer events to fire which in turn will cause your workflows to flow once more.

ReadOnlyCollection<SqlWorkflowPersistenceService> sqlSvc = 
   _workflowRuntime.GetAllServices<SqlWorkflowPersistenceService>();
 
IList<Guid> readyWorkflows = sqlSvc[0].LoadExpiredTimerWorkflowIds();
foreach (Guid wfGuid in readyWorkflows)
{
   _workflowRuntime.GetWorkflow(wfGuid).Resume();
}

I haven't fully tested it in a practical sense where I've got many runtimes sharing a persistence repository but I'll know more as the week progresses.

Matt Milner posted in the MSDN Workflow Foundation forum that the LoadIntervalSeconds setting on the SqlWorkflowPersistenceService will automatically load any persisted workflows based on that interval.  So the only reason to directly resume the workflows is if you feel that delay would be a problem for some reason.  Thanks, Matt.

Comments [1] | | # 
Tuesday, March 04, 2008 3:45:31 PM (Mountain Standard Time, UTC-07:00)
Cool, the post.

Thanks for the information.
Comments are closed.