@Singleton @Requires(property="micronaut.heartbeat.enabled",value="true",defaultValue="true") @Requires(property="micronaut.application.name") @Requires(beans=EmbeddedServer.class) @Requires(notEnv="android") 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, waitsupportspublic 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)
ApplicationEventListeneronApplicationEvent in interface ApplicationEventListener<ServiceStartedEvent>event - the event to respond to