Creates a new instance of this lambda function.
(optional) a container name (accessible via ContextInfo)
(optional) a container description (accessible via ContextInfo)
The map of registered actions.
The default path to config file.
The performanc counters.
The dependency resolver.
The map of registred validation schemas.
Calls registered action in this lambda function. "cmd" parameter in the action parameters determin what action shall be called.
This method shall only be used in testing.
action parameters.
callback function that receives action result or error.
Gets entry point into this lambda function.
an incoming event object with invocation parameters.
a context object with local references.
Adds instrumentation to log calls and measure call time. It returns a Timing object that is used to end the time measurement.
(optional) transaction id to trace execution through call chain.
a method name.
Timing object to end the time measurement.
Registers all actions in this lambda function.
This method is called by the service and must be overriden in child classes.
Registers an action in this lambda function.
a action/command name.
a validation schema to validate received parameters.
an action function that is called when action is invoked.
Runs this lambda function, loads container configuration, instantiate components and manage their lifecycle, makes this function ready to access action calls.
callback function that receives error or null for success.
Sets references to dependent components.
references to locate the component dependencies.
Generated using TypeDoc
Abstract AWS Lambda function, that acts as a container to instantiate and run components and expose them via external entry point.
When handling calls "cmd" parameter determines which what action shall be called, while other parameters are passed to the action itself.
Container configuration for this Lambda function is stored in
"./config/config.yml"
file. But this path can be overriden byCONFIG_PATH
environment variable.Configuration parameters
References
*:logger:*:*:1.0
(optional) ILogger components to pass log messages*:counters:*:*:1.0
(optional) ICounters components to pass collected measurements*:discovery:*:*:1.0
(optional) IDiscovery services to resolve connection*:credential-store:*:*:1.0
(optional) Credential stores to resolve credentialsLambdaClient
Example
class MyLambdaFunction extends LambdaFunction { private _controller: IMyController; ... public constructor() { base("mygroup", "MyGroup lambda function"); this._dependencyResolver.put( "controller", new Descriptor("mygroup","controller","*","*","1.0") ); } public setReferences(references: IReferences): void { base.setReferences(references); this._controller = this._dependencyResolver.getRequired<IMyController>("controller"); } public register(): void { registerAction("get_mydata", null, (params, callback) => { let correlationId = params.correlation_id; let id = params.id; this._controller.getMyData(correlationId, id, callback); }); ... } } let lambda = new MyLambdaFunction(); service.run((err) => { console.log("MyLambdaFunction is started"); });