Creates a new instance of this service.
The base route.
The performance counters.
The dependency resolver.
The HTTP 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.
Returns correlationId from request
http request
Returns correlationId from request
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 middleware for a given route in HTTP endpoint.
a command route. Base route will be added to this route
an action function that is called when middleware is invoked.
Registers a route in HTTP endpoint.
HTTP method: "get", "head", "post", "put", "delete"
a command route. Base route will be added to this route
a validation schema to validate received parameters.
an action function that is called when operation is invoked.
Registers a route with authorization in HTTP endpoint.
HTTP method: "get", "head", "post", "put", "delete"
a command route. Base route will be added to this route
a validation schema to validate received parameters.
an authorization interceptor
an action function that is called when operation is invoked.
Creates a callback function that sends newly created object as JSON. That callack function call be called directly or passed as a parameter to business logic components.
If object is not null it returns 201 status code. For null results it returns 204 status code. If error occur it sends ErrorDescription with approproate status code.
a HTTP request object.
a HTTP response object.
Creates a callback function that sends deleted object as JSON. That callack function call be called directly or passed as a parameter to business logic components.
If object is not null it returns 200 status code. For null results it returns 204 status code. If error occur it sends ErrorDescription with approproate status code.
a HTTP request object.
a HTTP response object.
Sends error serialized as ErrorDescription object and appropriate HTTP status code. If status code is not defined, it uses 500 status code.
a HTTP request object.
a HTTP response object.
an error object to be sent.
Creates a callback function that sends result as JSON object. That callack function call be called directly or passed as a parameter to business logic components.
If object is not null it returns 200 status code. For null results it returns 204 status code. If error occur it sends ErrorDescription with approproate status code.
a HTTP request object.
a HTTP response object.
Sets references to dependent components.
references to locate the component dependencies.
Unsets (clears) previously set references to dependent components.
Generated using TypeDoc
Service returns heartbeat via HTTP/REST protocol.
The service responds on /heartbeat route (can be changed) with a string with the current time in UTC.
This service route can be used to health checks by loadbalancers and container orchestrators.
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:http:*:1.0
(optional) HttpEndpoint referenceRestService
RestClient
Example
let service = new HeartbeatService(); service.configure(ConfigParams.fromTuples( "route", "ping", "connection.protocol", "http", "connection.host", "localhost", "connection.port", 8080 )); service.open("123", (err) => { console.log("The Heartbeat service is accessible at http://+:8080/ping"); });