WorkflowRuntimeService.OnStopped Method

Definition

When overridden in a derived class, represents the method that will be called when the workflow runtime engine raises the Stopped event.

protected:
 virtual void OnStopped();
protected virtual void OnStopped ();
abstract member OnStopped : unit -> unit
override this.OnStopped : unit -> unit
Protected Overridable Sub OnStopped ()

Remarks

The WorkflowRuntimeService class implements a two-phase stopping mechanism so that workflow runtime engine services may retain some functionality after their Stop method is invoked by the workflow runtime engine in order that they may, if necessary, support the shutdown of other services. After the workflow runtime engine has called the Stop method of all of its workflow runtime engine services, it raises the WorkflowRuntime.Stopped event. You can override the OnStopped method to provide any final shutdown functionality required by your service when the WorkflowRuntime.Stopped event is raised. The mechanics of subscribing and unsubscribing from the WorkflowRuntime.Stopped event is handled internally.

Note

If your WorkflowRuntimeService is removed from the workflow runtime engine by a call to RemoveService while the workflow runtime engine is running, the workflow runtime engine will call Stop on your service. However, in this situation, the OnStopped method will not be called for your service. Therefore, your service may have to perform any final shutdown that it would ordinarily perform in OnStopped from inside the Stop method. You can test IsStarted to determine whether the workflow runtime engine is running.

State is set to Stopped before OnStopped is invoked. The default implementation of OnStopped performs no action.

Applies to