Resuming Host-Runtime and Checking for Needed Services
We are building a workflow "host" which will load and run various workflows for the organization. Most workflows will require the Persistence and Tracking services, while some will need the ExternalDataExchange Service and other custom services we design.
What happens if we've loaded several services and have workflows running, persisted, etc. and the host is taken offline/crashes. When the host restarts and resumes any persisted/queued workflows will the host automatically invoke the required services for each workflow?
I know that we can check (from within the runtime host) to see if a specific service is running, and if it is not we can add it to the runtime. But what happens when the host comes back after a crash. Is the host smart enough to restart any necessary services?
Craig
[833 byte] By [
CraigT] at [2007-12-21]
Craig - Maybe I am oversimplifying the problem. But assuming the host adds the required services on starting the first time, why would it be any different if it crashes and restarts? On restart how will the host know <assuming we are not keeping track in some other durable media> which run it is and not add the required services?
This is how I see it:
[Host]:
1. Create a proper WF runtime
2. Add the required services
3. Start a new workflow/resume any persisted workflows
So long answer short, crashing and resuming shouldn't make a difference as long as you have proper persistence for your workflows.
Thanks,
Vignesh
Vignesh, your response sounds right.
I wasn't sure if the restart from persistance would bring back the necessary services.
As another example. I have one WF which is long running and requires a ExternalDataExchange along with persistence and tracking. I persist and unload the workflow (waiting for some long running process to complete). Now I shut down the runtime/host (simulating a crash). I then start another WF which doesn't use ExternalDataExchange but does use persistence and tracking.
When the first WF resumes will it be able to run if the ExternalDataExchange service hasn't been added to the runtime? Remember the second WF doesn't use it. Will I get an error? Is there a way around this? Or will the runtime simply reload this service?
The host is responsible for adding all services that are required by the workflows that it is running.So the answer is Yes, you will get an error if your workflow needs the ExternalDataExchange service and it has not been added.The runtime does not automatically load the service.
Thanks Tom, I tested this out and came to that conclusion. I just wanted to have you guys confirm it.
So, our problem now is when the runtime starts a persisted workflow we will need to check that all of the necessary servcies are running for that workflow. If they are not we'll call AddService() to add the appropriate services.
Is there a way to use GetAllServices() from within the workflow (using DataExchange and an Interface, etc. to talk with the host) so that the information can be retrieved and saved to a seperate database? (It would include WF name, required services, WF version, etc).
Or am I not able to do this from within the workflow. Would I be better off doing this myself and calling out to my seperate database to get a list of necessary services before starting a persisted workflow?
Is this even possible to do when a persisted workflow restarts? I'm betting that I will have to write some code in the Host service to get a list of all possible services for all workflows and just add all of them to the host. That way when any workflow restarts it will already have the necessary services and will run successfully.
Thanks,
Craig