views:

39

answers:

1

I've got a .Net 4.0 Workflow application hosted in WCF that takes a request to process some information. This information is passed to a secondary system via a web service and returns a bool indicating that its going to process that information.

My workflow then loops, sleeping for 5 minutes and then querying the secondary system to see if processing of the information is complete.

When its complete the workflow finishes.

I have this persisting in SQL, and it works perfectly.

My question is how do I retrieve a list of the persisted workflows in such a way that I can tie them back to the original request? I'd like my UI to be able to list the running workflows in a grid with the elapsed time that they've been run.

I've thought about storing the workflow GUID in my primary DB and generating the list that way, but what I'd really like is to be able to reconcile what I think is running, and what the persistant store thinks is running.

I'd also like to be able to select a running workflow and kill it off or completely restart it if the user determines that its gone screwy.

+1  A: 

You can promote data from the workflow using the SqlWorkflowInstanceStore. The result is they are stored alongside the workflow data in the InstancesTable using the InstancePromotedPropertiesTable. Using the InstancePromotedProperties view is the easiest way of querying you data.

This blog post will show you the code you need.

Maurice