Windows Workflow Foundation 3
After wf receives external event, the host never sees any more tracking events
I have a host which starts workflows. It implements a TrackingChannel and TrackingService, and it sees a flurry of tracking events when a workflow starts running.My workflow includes a HandleExternalEvent activity. The event that satisfies this is raised by a separate application, which of course loads the runtime etc. This second application does not implement TrackingChannel/TrackingService.When that event is fired, the workflow proceeds on its way as it should. But the host that originally started it, although still running with its tracking stuff active, sees no more tracking events for that workflow. I was expecting these events to continue to be reported to it.What am I missing here?
Tracking is a service that runs in the host. If your second host that hydrates the persisted workflow that was originally running in the first host does not have these tracking services, then there will be no more tracking. The first host will still have a running WorkflowRuntime with tracking services, but no running Workflow (since it is now running in the second host) Does that make sense? If you want to have tracking then each Workflow runtime that may run a Workflow needs to have a loaded Tracking service. Steve Danielson [Microsoft]This posting is provided "AS IS" with no warranties, and confers no rights.
If both/all of your hosts used the same database for SQLTracking then you would be able to query this database for your tracking data for the workflow and it should be pretty seamless for you. If a Workflow is persisted and then hydrated by multiple hosts, each of which have the traking service registered, then all of the tracking info for that one workflow should be in that one database. Steve Danielson [Microsoft]This posting is provided "AS IS" with no warranties, and confers no rights.
Tracking is a service that runs in the host. If your second host that hydrates the persisted workflow that was originally running in the first host does not have these tracking services, then there will be no more tracking. The first host will still have a running WorkflowRuntime with tracking services, but no running Workflow (since it is now running in the second host) Does that make sense? If you want to have tracking then each Workflow runtime that may run a Workflow needs to have a loaded Tracking service. Steve Danielson [Microsoft]This posting is provided "AS IS" with no warranties, and confers no rights.
Yes, that makes sense. I had sort of been imagining that the tracking was a publish-subscribe pattern where each host was subscribed to tracking events published by the workflow. But from what you have explained it seems more as if the first host unsubscribes when the workflow is idled. (Or maybe it's just wrong to think of tracking in publish-subscribe terms.)So if I wanted to compile a complete history of all the tracking information emitted by a workflow, I guess I would have to implement my own scheme to stitch together the events from each host that interacts with the workflow. What would happen if both of my apps used the SQLTrackingService and stored everything in the same instance of the tracking database?
If both/all of your hosts used the same database for SQLTracking then you would be able to query this database for your tracking data for the workflow and it should be pretty seamless for you. If a Workflow is persisted and then hydrated by multiple hosts, each of which have the traking service registered, then all of the tracking info for that one workflow should be in that one database. Steve Danielson [Microsoft]This posting is provided "AS IS" with no warranties, and confers no rights.
Related Links
WorkFlow will not start. Stuck on workflowRuntime.CreateWorkflow?
Is there the ability for business users to modify the workflow?
How to: Activity Data Bind a collection object, not it's contents.
Problems with Ownership, Timers etc
CustomPersistedService
Workflow and Development Modes
My workflow deriving from my own workflow base class - will it work?
Object To Object Map Activity
Distributed Transaction with WWF
MaxInstances WorkflowRuntime
Remote workflow tracking
callback trigger
Question about hosting
Context bindings wsdl generation
Use of HandleExternalEvent result in an IfElse activity
Custom Activity Designer