public class HeartbeatRestService extends RestService
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 ###
HttpEndpoint reference
### Example ###
HeartbeatService service = new HeartbeatService();
service.configure(ConfigParams.fromTuples(
"route", "ping",
"connection.protocol", "http",
"connection.host", "localhost",
"connection.port", 8080
));
service.open("123");
System.out.println("The Heartbeat service is accessible at http://+:8080/ping");
RestService_baseRoute, _counters, _dependencyResolver, _endpoint, _logger, _server, _url| Constructor and Description |
|---|
HeartbeatRestService()
Creates a new instance of this service.
|
| Modifier and Type | Method and Description |
|---|---|
void |
configure(org.pipservices.commons.config.ConfigParams config)
Configures component by passing configuration parameters.
|
void |
register()
Registers all service routes in HTTP endpoint.
|
close, getBodyAsJson, getBodyAsString, getQueryParameter, instrument, isOpen, open, registerResource, registerRoute, sendCreatedResult, sendDeleted, sendEmptyResult, sendError, sendResult, setReferences, unsetReferencespublic HeartbeatRestService()
public void configure(org.pipservices.commons.config.ConfigParams config)
throws org.pipservices.commons.errors.ConfigException
configure in interface org.pipservices.commons.config.IConfigurableconfigure in class RestServiceconfig - configuration parameters to be set.org.pipservices.commons.errors.ConfigException - when configuration is wrong.public void register()
Copyright © 2018. All rights reserved.