Table of Contents

Interface IWorkflowEventManager

Namespace
Acuit.Pinpoint.Workflows.Workstation
Assembly
Acuit.Pinpoint.Workflows.Workstation.dll

A workflow event manager.

public interface IWorkflowEventManager

Remarks

This is not thread-safe. All methods are expected to be called from the main application thread.

Methods

AddParameterValueProvider(IParameterValueProvider)

Adds a parameter value provider that will provide parameter values to any workflows executed in the future via workflow events.

IDisposable AddParameterValueProvider(IParameterValueProvider parameterValueProvider)

Parameters

parameterValueProvider IParameterValueProvider

The parameter value provider.

Returns

IDisposable

A IDisposable that can be used to remove the parameter value provider.

Remarks

Adding the same instance of a parameter value provider multiple times is supported and optimized. When parameter values are requested, a provider will not be checked multiple times.

Exceptions

ArgumentNullException

parameterValueProvider is null.

AddServiceProvider(IServiceProvider)

Adds a service provider that will provide services to any workflows executed in the future via workflow events.

IDisposable AddServiceProvider(IServiceProvider serviceProvider)

Parameters

serviceProvider IServiceProvider

The service provider.

Returns

IDisposable

A IDisposable that can be used to remove the service provider.

Remarks

Adding the same instance of a service provider multiple times is supported and optimized. When a service is requested, the provider will not be checked multiple times.

Exceptions

ArgumentNullException

serviceProvider is null.

AddWorkflowEventHandler(string, IActivity, WorkflowEventHandlerOptions?)

Adds a workflow event handler.

IDisposable AddWorkflowEventHandler(string eventName, IActivity workflow, WorkflowEventHandlerOptions? workflowOptions = null)

Parameters

eventName string

The event name. Event names are case-insensitive.

workflow IActivity

The workflow.

workflowOptions WorkflowEventHandlerOptions

Optional workflow event handler options.

Returns

IDisposable

A IDisposable that can be used to remove the event handler.

Remarks

The last workflow added will be the one executed when the event is raised. The workflow can optionally execute previously-added/default workflow event handler(s) via the ExecuteDefaultHandler activity.

Exceptions

ArgumentNullException

eventName is null.

ArgumentNullException

workflow is null.

HasHandler(string)

Determines whether a workflow event has a handler that has been added.

bool HasHandler(string eventName)

Parameters

eventName string

The event name. Event names are case-insensitive.

Returns

bool

true if one or more handlers have been added for the event; otherwise, false.

Exceptions

ArgumentNullException

eventName is null.

RaiseEventAsync(WorkflowEvent, RaisedWorkflowEventOptions?, CancellationToken)

Raises a workflow event.

Task RaiseEventAsync(WorkflowEvent workflowEvent, RaisedWorkflowEventOptions? options = null, CancellationToken cancellationToken = default)

Parameters

workflowEvent WorkflowEvent

The event.

options RaisedWorkflowEventOptions

The optional options for the raised workflow event.

cancellationToken CancellationToken

The token used to request canceling any event handler(s).

Returns

Task

A task that represents the asynchronous operation, which will not complete until any executed workflow completes.

Remarks

If a workflow is executed in response to this event, it will be provided the following:

Exceptions

ArgumentNullException

workflowEvent is null.

WorkflowParameterException

An error occurred initializing parameter values within the workflow handler.

WorkflowException

An unhandled error occurred in the workflow handler. InnerException will contain the unhandled exception.