Helper class that allows you to execute one or more components.
Description
The Executor class allows you to execute one or more components.
Methods
Execute
Executes multiple components.
To be executed components must implement the IExecutable interface.
If they don’t, the call to this method has no effect.
See IExecutable, Parameters
Execute(context.Context, correlationId string, components []any, args *Parameters) ([]any, error)
- ctx: context.Context - operation context.
- correlationId: string - (optional) transaction id used to trace execution through the call chain.
- components: []any - list of components that are to be executed.
- args: *Parameters - execution arguments.
- returns: ([]any, error) - execution result
ExecuteOne
Executes a specific component.
To be executed a component must implement the IExecutable interface. If they don’t, the call to this method has no effect.
ExecuteOne(ctx context.Context, correlationId string, component any, args *Parameters) (any, error)
- ctx: context.Context - operation context.
- correlationId: string - (optional) transaction id used to trace execution through the call chain.
- component: any - component that is to be executed.
- args: *Parameters - execution arguments.
- returns: (any, error) - execution result.