Creates a new instance of this service.
a service role (name).
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.
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 to operations automatically generated for commands defined in ICommandable components. Each command is exposed as a Seneca action with the same name.
Commandable services require only 3 lines of code to implement a robust external SenecaHTTP-based remote interface.
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 referenceCommandableSenecaClient
[[RestService]]
Example
class MyCommandableSenecaService extends CommandableSenecaService { public constructor() { base("mydata"); this._dependencyResolver.put( "controller", new Descriptor("mygroup","controller","*","*","1.0") ); } } let service = new MyCommandableSenecaService(); 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 REST service is running on port 8080"); });