@Singleton @HeartbeatEnabled public class HeartbeatTask extends java.lang.Object implements ApplicationEventListener<ServiceReadyEvent>
Constructor and Description |
---|
HeartbeatTask(ApplicationEventPublisher eventPublisher,
HeartbeatConfiguration configuration,
CurrentHealthStatus currentHealthStatus) |
Modifier and Type | Method and Description |
---|---|
void |
onApplicationEvent(ServiceReadyEvent event)
Handle an application event.
|
void |
pulsate()
Publish the heartbeat event with current health status.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
supports
public HeartbeatTask(ApplicationEventPublisher eventPublisher, HeartbeatConfiguration configuration, CurrentHealthStatus currentHealthStatus)
eventPublisher
- To publish the events related to heartbeatconfiguration
- The configurations for heartbeatcurrentHealthStatus
- The current status of health indicator@Scheduled(fixedDelay="${micronaut.heartbeat.interval:15s}", initialDelay="${micronaut.heartbeat.initial-delay:5s}") public void pulsate()
public void onApplicationEvent(ServiceReadyEvent event)
ApplicationEventListener
onApplicationEvent
in interface ApplicationEventListener<ServiceReadyEvent>
event
- the event to respond to