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
IParameterValueProviderThe 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
stringThe event name. Event names are case-insensitive.
workflow
IActivityThe workflow.
workflowOptions
WorkflowEventHandlerOptionsOptional 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
WorkflowExceptionThe workflow exception.
workflowEvent
WorkflowEventThe raised event.
interactive
boolWhether 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
stringThe event name. Event names are case-insensitive.
Returns
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
WorkflowEventThe event.
defaultWorkflow
IActivityThe default workflow handler, or null if there is none.
defaultWorkflowOptions
WorkflowEventHandlerOptionsOptional default workflow event handler options.
parameterValueProvider
IParameterValueProviderAn optional parameter value provider to provide additional parameters to any workflow executed in response to this event.
serviceProvider
IServiceProviderAn 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
CancellationTokenThe 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:
- The
parameterValueProvider
value provided to this method, if not null. - The single value named "WorkflowEvent" that provides the WorkflowEvent that was raised.
- 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. - 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.
- The
A composite service provider that will provide services from the following sources, in order of decreasing precedence:
- The
serviceProvider
value provided to this method, if not null. - A IWorkflowEventContext service instance that provides context for the raised event.
- 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. - 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. - The Acuit Pinpoint Workstation host service provider, which provides all of the normal Acuit Pinpoint Workstation services.
- The
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
WorkflowEventThe event.
options
RaisedWorkflowEventOptionsThe optional options for the raised workflow event.
cancellationToken
CancellationTokenThe 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:
- The
options
.ParameterValueProvider value provided to this method, if not null. - The single value named "WorkflowEvent" that provides the WorkflowEvent that was raised.
- The ParameterValueProvider value of the WorkflowEventHandlerOptions provided when the workflow event handler was added (or of the
options
.DefaultWorkflowOptions parameter for the default workflow), if not null. - 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.
- The
A composite service provider that will provide services from the following sources, in order of decreasing precedence:
- The
options
.ServiceProvider value provided to this method, if not null. - A IWorkflowEventContext service instance that provides context for the raised event.
- A IUriContext service that provides the BaseUri value of the WorkflowEventHandlerOptions provided when the workflow event handler was added (or of the
options
.DefaultWorkflowOptions parameter for the default workflow), if not null. - The ServiceProvider value of the WorkflowEventHandlerOptions provided when the workflow event handler was added (or of the
options
.DefaultWorkflowOptions parameter for the default workflow), if not null. - The Acuit Pinpoint Workstation host service provider, which provides all of the normal Acuit Pinpoint Workstation services.
- The
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.