IExecutable

Interface that allows you to create a component that can be called to execute work.

Description

The IExecutable interface allows you to create a component that can be called to execute work.

Instance methods

execute

Executes a component with arguments and receives the execution result.

execute(context: IContext, args: Parameters): Promise<any>

  • context: IContext - (optional) execution context to trace execution through call chain.
  • args: Parameters - execution arguments.
  • returns: Promise<any> - execution result.

Examples

	type EchoComponent {}
		...
		func  (ec* EchoComponent) Execute(ctx context.Context, args *Parameters) (result any, err error) {
			return nil, result = args.getAsObject("message")
		}
		echo := EchoComponent{};
		message = "Test";
		res, err = echo.Execute(ctx, NewParametersFromTuples("message", message));
		fmt.Println(res);

See also