@Singleton @HeartbeatEnabled public class HeartbeatTask extends Object implements ApplicationEventListener<ServiceStartedEvent>
Constructor and Description |
---|
HeartbeatTask(ApplicationEventPublisher eventPublisher,
HeartbeatConfiguration configuration,
CurrentHealthStatus currentHealthStatus) |
Modifier and Type | Method and Description |
---|---|
void |
onApplicationEvent(ServiceStartedEvent 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(ServiceStartedEvent event)
ApplicationEventListener
onApplicationEvent
in interface ApplicationEventListener<ServiceStartedEvent>
event
- the event to respond to