Documentation
¶
Overview ¶
Package executor defines the interface that bridges tasks enqueued by the processor with the backing implementation of actions. It is effectively a glue layer between the high-level workflow model and low-level service implementations.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrTaskNotFound = errors.New("task not found in workflow") ErrMethodNotFound = errors.New("method not found in service") )
Functions ¶
func StdoutListener ¶
StdoutListener replicates the debug prints that were hard-coded in the previous implementation. It serialises the task specification, input and output into JSON and prints them to standard output. Errors from json.Marshal are ignored on purpose – they indicate non-serialisable values and the caller would not have had access to the data either way in the original implementation.
Types ¶
type Listener ¶
Listener is invoked once a task action completes (regardless of whether it returned an error or not). Implementations can log, collect metrics or perform any other side-effects they require.
For convenience the listener is defined as a function type rather than an interface; users can therefore pass a plain function literal when customising the executor.
type Option ¶
type Option func(*service)
Option is used to customise the executor instance.
func WithApprovalService ¶ added in v0.1.1
WithApprovalService applies the approval service to the executor. The approval service is used to
func WithApprovalSkipPrefixes ¶ added in v0.1.2
WithApprovalSkipPrefixes configures the executor so that actions whose fully qualified name (service.method, lower-cased) starts with any of the specified prefixes will bypass the approval request in policy ModeAsk.
func WithListener ¶
WithListener overrides the listener invoked after every executed task. Passing nil disables the callback entirely.