Calls a remote method via HTTP/REST protocol.
a service role (service name)
a command name
(optional) transaction id to trace execution through call chain.
(optional) command parameters.
(optional) callback function that receives result object or error.
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.
Resolves and validates connection to 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 client that calls remove endpoints using 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[[RestService]]
[[CommandableHttpService]]
Example
class MySenecaClient extends SenecaClient implements IMyClient { ... public getData(correlationId: string, id: string, callback: (err: any, result: MyData) => void): void { let timing = this.instrument(correlationId, 'myclient.get_data'); this.call("mydata", "get_data" correlationId, { id: id }, (err, result) => { timing.endTiming(); callback(err, result); }); } ... } let client = new MySenecaClient(); client.configure(ConfigParams.fromTuples( "connection.protocol", "http", "connection.host", "localhost", "connection.port", 8080 )); client.getData("123", "1", (err, result) => { ...
});