Is there any way to capture the event whenever any instance is shut down so that I can send an email/notification?
I tried the below snippet but didn't work...
ApplicationInfoManager.StatusChangeListener statusChangeListener = new ApplicationInfoManager.StatusChangeListener() {
@Override
public String getId() {
return "statusChangeListener";
}
@Override
public void notify(StatusChangeEvent statusChangeEvent) {
if (InstanceStatus.DOWN == statusChangeEvent.getStatus()
|| InstanceStatus.DOWN == statusChangeEvent.getPreviousStatus()) {
// log at warn level if DOWN was involved
logger.warn("Saw local status change event {}", statusChangeEvent);
} else {
logger.info("Saw local status change event {}", statusChangeEvent);
}
// instanceInfoReplicator.onDemandUpdate();
}
};
Comment From: ranjanjha95
The below statements are present in the log
Registered instance SHOPPING-SERVICE/localhost:SHOPPING-SERVICE:9999 with status UP (replication=false)
2021-01-13 09:25:05.266 INFO 21496 --- [nio-8761-exec-8] c.n.e.registry.AbstractInstanceRegistry : Registered instance SHOPPING-SERVICE/localhost:SHOPPING-SERVICE:9999 with status DOWN (replication=false)
2021-01-13 09:25:05.282 INFO 21496 --- [nio-8761-exec-9] c.n.e.registry.AbstractInstanceRegistry : Cancelled instance SHOPPING-SERVICE/localhost:SHOPPING-SERVICE:9999 (replication=false)
but events are not getting captured in the Eureka Server application.
Comment From: spencergibb
How did you add the listener to ApplicationInfoManager?
Comment From: spring-cloud-issues
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.
Comment From: spring-cloud-issues
Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.