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

AddContextParameterValueProvider(IParameterValueProvider)

Adds a context parameter value provider.

IDisposable AddContextParameterValueProvider(IParameterValueProvider parameterValueProvider)

Parameters

parameterValueProvider IParameterValueProvider

The parameter value provider.

Returns

IDisposable

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

Remarks

Context parameter value providers are available to workflows executed in response to events.

Exceptions

ArgumentNullException

parameterValueProvider 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.

HandleWorkflowEventHandlerError(WorkflowException, WorkflowEvent, bool)

Performs standard workflow error handling for a workflow handler error.

void HandleWorkflowEventHandlerError(WorkflowException exception, WorkflowEvent workflowEvent, bool interactive)

Parameters

exception WorkflowException

The workflow exception.

workflowEvent WorkflowEvent

The raised event.

interactive bool

Whether the workflow event was raised via interactive operator action. This affects how the alarm is displayed.

Remarks

This will log the error details and add an alarm.

Exceptions

ArgumentNullException

exception is null.

ArgumentNullException

workflowEvent 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, IActivity, WorkflowEventHandlerOptions, IParameterValueProvider, IServiceProvider, Action<IRaisedWorkflowEventConfiguration>, CancellationToken)

Raises a workflow event.

[Obsolete("This is deprecated and will be removed in a future version; RaiseEventAsync(WorkflowEvent, RaisedWorkflowEventOptions, CancellationToken)  should be used instead.")]
Task RaiseEventAsync(WorkflowEvent workflowEvent, IActivity defaultWorkflow, WorkflowEventHandlerOptions defaultWorkflowOptions = null, IParameterValueProvider parameterValueProvider = null, IServiceProvider serviceProvider = null, Action<IRaisedWorkflowEventConfiguration> configureAction = null, CancellationToken cancellationToken = default)

Parameters

workflowEvent WorkflowEvent

The event.

defaultWorkflow IActivity

The default workflow handler, or null if there is none.

defaultWorkflowOptions WorkflowEventHandlerOptions

Optional default workflow event handler options.

parameterValueProvider IParameterValueProvider

An optional parameter value provider to provide additional parameters to any workflow executed in response to this event.

serviceProvider IServiceProvider

An optional service provider to provide additional services to any workflow executed in response to this event.

configureAction Action<IRaisedWorkflowEventConfiguration>

An optional delegate that can be used to configure how the event is raised, to enable additional interactions with the executing workflow.

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:

  • A composite parameter value provider that will provide parameter values from the following sources, in order of decreasing precedence:

    1. The parameterValueProvider value provided to this method, if not null.
    2. The single value named "WorkflowEvent" that provides the WorkflowEvent that was raised.
    3. The ParameterValueProvider value of the WorkflowEventHandlerOptions provided when the workflow event handler was added (or of the defaultWorkflowOptions parameter for the default workflow), if not null.
    4. All currently-active context parameter providers (i.e., that have not been disposed) added via AddContextParameterValueProvider(IParameterValueProvider), in reverse order in which they were added.
  • A composite service provider that will provide services from the following sources, in order of decreasing precedence:

    1. The serviceProvider value provided to this method, if not null.
    2. A IWorkflowEventContext service instance that provides context for the raised event.
    3. A IUriContext service that provides the BaseUri value of the WorkflowEventHandlerOptions provided when the workflow event handler was added (or of the defaultWorkflowOptions parameter for the default workflow), if not null.
    4. The ServiceProvider value of the WorkflowEventHandlerOptions provided when the workflow event handler was added (or of the defaultWorkflowOptions parameter for the default workflow), if not null.
    5. The Acuit Pinpoint Workstation host service provider, which provides all of the normal Acuit Pinpoint Workstation services.

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.

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.