Creates a new instance of the service.
a service name.
The performance counters.
The dependency resolver.
The GRPC endpoint that exposes this service.
The logger.
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.
Registers all service routes in HTTP endpoint.
Registers a commandable method in this objects GRPC server (service) by the given name.,
the GRPC method name.
the schema to use for parameter validation.
the action to perform at the given route.
Registers a middleware for methods in GRPC endpoint.
an action function that is called when middleware is invoked.
Registers a method in GRPC service.
a method name
a validation schema to validate received parameters.
an action function that is called when operation is invoked.
Sets references to dependent components.
references to locate the component dependencies.
Unsets (clears) previously set references to dependent components.
Generated using TypeDoc
Abstract service that receives commands via GRPC protocol to operations automatically generated for commands defined in ICommandable components. Each command is exposed as invoke method that receives command name and parameters.
Commandable services require only 3 lines of code to implement a robust external GRPC-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:grpc:*:1.0
(optional) GrpcEndpoint referenceCommandableGrpcClient
GrpcService
Example
class MyCommandableGrpcService extends CommandableGrpcService { public constructor() { base(); this._dependencyResolver.put( "controller", new Descriptor("mygroup","controller","*","*","1.0") ); } } let service = new MyCommandableGrpcService(); 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 GRPC service is running on port 8080"); });