pip_services3_rpc.services.HeartbeatRestService module

pip_services3_rpc.services.HeartbeatRestService

Heartbeat rest service implementation

copyright

Conceptual Vision Consulting LLC 2018-2019, see AUTHORS for more details.

license

MIT, see LICENSE for more details.

class pip_services3_rpc.services.HeartbeatRestService.HeartbeatRestService

Bases: pip_services3_rpc.services.RestService.RestService

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 ###
  • base_route: base route for remote URI (default: “”)

  • route: route to heartbeat operation (default: “heartbeat”)

  • dependencies:
    • endpoint: override for HTTP Endpoint dependency

  • connection(s):

  • discovery_key: (optional) a key to retrieve the connection from IDiscovery

  • protocol: connection protocol: http or https

  • host: host name or IP address

  • port: port number

  • uri: resource URI or connection string with all parameters in it

### 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 reference

Example:

service = HeartbeatService()
service.configure(ConfigParams.from_tuples("route", "ping",
                                           "connection.protocol", "http",
                                           "connection.host", "localhost",
                                           "connection.port", 8080))

service.open("123")
# ...
configure(config: pip_services3_commons.config.ConfigParams.ConfigParams)

Configures component by passing configuration parameters.

Parameters

config – configuration parameters to be set.

heartbeat() str

Handles heartbeat requests

Returns

http response to the request.

register()

Registers all service routes in HTTP endpoint.