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
parameterValueProviderIParameterValueProviderThe 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
parameterValueProvideris null.
AddWorkflowEventHandler(string, IActivity, WorkflowEventHandlerOptions)
Adds a workflow event handler.
IDisposable AddWorkflowEventHandler(string eventName, IActivity workflow, WorkflowEventHandlerOptions workflowOptions = null)
Parameters
eventNamestringThe event name. Event names are case-insensitive.
workflowIActivityThe workflow.
workflowOptionsWorkflowEventHandlerOptionsOptional 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
eventNameis null.- ArgumentNullException
workflowis null.
HandleWorkflowEventHandlerError(WorkflowException, WorkflowEvent, bool)
Performs standard workflow error handling for a workflow handler error.
void HandleWorkflowEventHandlerError(WorkflowException exception, WorkflowEvent workflowEvent, bool interactive)
Parameters
exceptionWorkflowExceptionThe workflow exception.
workflowEventWorkflowEventThe raised event.
interactiveboolWhether 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
exceptionis null.- ArgumentNullException
workflowEventis null.
HasHandler(string)
Determines whether a workflow event has a handler that has been added.
bool HasHandler(string eventName)
Parameters
eventNamestringThe event name. Event names are case-insensitive.
Returns
Exceptions
- ArgumentNullException
eventNameis 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
workflowEventWorkflowEventThe event.
defaultWorkflowIActivityThe default workflow handler, or null if there is none.
defaultWorkflowOptionsWorkflowEventHandlerOptionsOptional default workflow event handler options.
parameterValueProviderIParameterValueProviderAn optional parameter value provider to provide additional parameters to any workflow executed in response to this event.
serviceProviderIServiceProviderAn optional service provider to provide additional services to any workflow executed in response to this event.
configureActionAction<IRaisedWorkflowEventConfiguration>An optional delegate that can be used to configure how the event is raised, to enable additional interactions with the executing workflow.
cancellationTokenCancellationTokenThe 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
parameterValueProvidervalue 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
defaultWorkflowOptionsparameter 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
serviceProvidervalue 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
defaultWorkflowOptionsparameter for the default workflow), if not null. - The ServiceProvider value of the WorkflowEventHandlerOptions provided when the workflow event handler was added (or of the
defaultWorkflowOptionsparameter 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
workflowEventis 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
workflowEventWorkflowEventThe event.
optionsRaisedWorkflowEventOptionsThe optional options for the raised workflow event.
cancellationTokenCancellationTokenThe 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
workflowEventis 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.