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
parameterValueProviderIParameterValueProviderThe 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
parameterValueProvideris 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
serviceProviderIServiceProviderThe 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
serviceProvideris 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.
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, 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. - Each parameter provider added via AddParameterValueProvider(IParameterValueProvider), in reverse order in which they were added.
- The Acuit Pinpoint Workstation host context parameter provider, which provides station, worker, and unit parameters.
- 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. - Each service provider added via AddServiceProvider(IServiceProvider), in reverse order in which they were added.
- 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.