Creates a new instance of the client.
The controller reference.
The performance counters
The dependency resolver to get controller reference.
The logger.
The open flag.
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 CounterTiming object that is used to end the time measurement.
(optional) transaction id to trace execution through call chain.
a method name.
CounterTiming object to end the time measurement.
Adds instrumentation to error handling.
(optional) transaction id to trace execution through call chain.
a method name.
an occured error
(optional) an execution result
(optional) an execution callback
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.
Sets references to dependent components.
references to locate the component dependencies.
Generated using TypeDoc
Abstract client that calls controller directly in the same memory space.
It is used when multiple microservices are deployed in a single container (monolyth) and communication between them can be done by direct calls rather then through the network.
Configuration parameters
References
*:logger:*:*:1.0
(optional) ILogger components to pass log messages*:counters:*:*:1.0
(optional) ICounters components to pass collected measurements*:controller:*:*:1.0
controller to call business methodsExample
class MyDirectClient extends DirectClient<IMyController> implements IMyClient { public constructor() { super(); this._dependencyResolver.put('controller', new Descriptor( "mygroup", "controller", "*", "*", "*")); } ... public getData(correlationId: string, id: string, callback: (err: any, result: MyData) => void): void { let timing = this.instrument(correlationId, 'myclient.get_data'); this._controller.getData(correlationId, id, (err, result) => { timing.endTiming(); this.instrumentError(correlationId, 'myclient.get_data', err, result, callback); }); } ... } let client = new MyDirectClient(); client.setReferences(References.fromTuples( new Descriptor("mygroup","controller","default","default","1.0"), controller )); client.getData("123", "1", (err, result) => { ... });