Closes component and frees used resources.
(optional) transaction id to trace execution through call chain.
callback function that receives error or null no errors occured.
Configures component by passing configuration parameters.
configuration parameters to be set.
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.
Checks if the component is opened.
true if the component has been opened and false otherwise.
Opens the component.
(optional) transaction id to trace execution through call chain.
callback function that receives error or null no errors occured.
Registers all service actions.
This method is called by the service and must be overriden in child classes.
Registers an action in Seneca endpoint.
a service role (name)
a command name
a validation schema to validate received parameters.
an action function that is called when action is invoked.
Resolves and validates connection for Seneca service.
(optional) transaction id to trace execution through call chain.
callback function that receives connection parameters or error.
Sets references to dependent components.
references to locate the component dependencies.
Generated using TypeDoc
Abstract service that receives remove calls via Seneca protocol.
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*:endpoint:seneca:*:1.0
(optional) SenecaEndpoint referenceSenecaClient
Example
class MySenecaService extends SenecaService { private _controller: IMyController; ... public constructor() { base(); 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("mydata", "get_data", null, (params, callback) => { let correlationId = params.correlation_id; let id = params.id; this._controller.getMyData(correlationId, id, callback); }); ... } } let service = new MySenecaService(); service.configure(ConfigParams.fromTuples( "connection.protocol", "http", "connection.host", "localhost", "connection.port", 8080 )); service.setReferences(References.fromTuples( new Descriptor("mygroup","controller","default","default","1.0"), controller )); service.open("123", (err) => { console.log("The Seneca service is running on port 8080"); });