Class ServiceRegistrationBean

java.lang.Object
com.nmontytskyi.monitoring.starter.registration.ServiceRegistrationBean

public class ServiceRegistrationBean extends Object
Spring lifecycle bean that registers and de-registers the host microservice with the central monitoring server.

On Lifecycle.start() the bean sends a POST /api/services request to the monitoring server containing the service name, host, port, base URL, actuator URL, and initial SLA thresholds read from MonitoringProperties. The server-assigned service ID is stored for subsequent metric push requests.

On Lifecycle.stop() a DELETE /api/services/{id} request is sent so the server can mark the service as inactive rather than waiting for a polling timeout.

Author:
Nazar Montytskyi
See Also:
  • Constructor Details

    • ServiceRegistrationBean

      public ServiceRegistrationBean()
  • Method Details

    • register

      @PostConstruct public void register()
    • getServiceId

      public Long getServiceId()