Search in sources :

Example 1 with HeartbeatEvent

use of io.micronaut.health.HeartbeatEvent in project micronaut-core by micronaut-projects.

the class AutoRegistration method onApplicationEvent.

@Override
public void onApplicationEvent(AbstractServiceInstanceEvent event) {
    if (registrationConfiguration.isEnabled()) {
        if (event instanceof ServiceReadyEvent) {
            register(event.getSource());
        } else if (event instanceof ServiceStoppedEvent) {
            if (registrationConfiguration.isDeregister()) {
                deregister(event.getSource());
            }
        } else if (event instanceof HeartbeatEvent) {
            HeartbeatEvent heartbeatEvent = (HeartbeatEvent) event;
            pulsate(event.getSource(), heartbeatEvent.getStatus());
        }
    }
}
Also used : HeartbeatEvent(io.micronaut.health.HeartbeatEvent) ServiceReadyEvent(io.micronaut.discovery.event.ServiceReadyEvent) ServiceStoppedEvent(io.micronaut.discovery.event.ServiceStoppedEvent)

Aggregations

ServiceReadyEvent (io.micronaut.discovery.event.ServiceReadyEvent)1 ServiceStoppedEvent (io.micronaut.discovery.event.ServiceStoppedEvent)1 HeartbeatEvent (io.micronaut.health.HeartbeatEvent)1