Condividi tramite


Creating Custom Scheduling Services

A workflow scheduler service is a service that is used by the workflow runtime engine to determine which threads are used to start workflows. By creating a custom workflow scheduler service, you can control what threads the workflow runtime uses.

Two workflow scheduler services are provided:

To create a custom scheduling service, you must derive from the WorkflowSchedulerService base class and provide implementations for three methods. These methods are called by the workflow runtime engine when it needs to execute workflows.

  • Schedule

    This method is called by the workflow runtime engine to request that a workflow instance be started immediately. The implementation of this method should invoke the callback method, on an appropriate thread, passing in the workflowInstanceId as a parameter.

  • Schedule

    This method is called by the workflow runtime engine to request that a workflow instance be executed sometime in the future. The implementation of this method should invoke the callback method, passing the workflowInstanceId. It should invoke the callback no earlier than the specified UTC time.

  • Cancel

    This method is called by the runtime engine to cancel a request for a previously scheduled workflow. The System.Guid that is passed as a parameter to this method will match the timerId parameter of a previous invocation of the Schedule method. Requests to cancel workflows that have already executed can be ignored.

    Note

    When a workflow is unloaded, its outstanding schedule requests are canceled. When a workflow is reloaded, the requests are rescheduled at that time.

See Also

Reference

WorkflowSchedulerService
DefaultWorkflowSchedulerService
ManualWorkflowSchedulerService
Schedule
Schedule
Cancel

Concepts

Using DefaultWorkflowSchedulerService
Windows Workflow Scheduling Services
Developing Windows Workflow Foundation Services