Skip to content

Commit

Permalink
EVCACHE-454: Ideally, app should not serve traffic until it is health…
Browse files Browse the repository at this point in the history
…y but this option - ignoreAppEurekaStatus will allow app to ignore application eureka status while trying to initialize evcache client. This feature `may` be required for applications which are behind load balancers. They may fail to register successfully with eureka but are still expected to serve traffic.
  • Loading branch information
arunagrawal84 committed Mar 23, 2021
1 parent b8ab182 commit 430358d
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,14 @@ public EurekaNodeListProvider(ApplicationInfoManager applicationInfoManager, Eur
*/
@Override
public Map<ServerGroup, EVCacheServerGroupConfig> discoverInstances(String _appName) throws IOException {
if ((applicationInfoManager.getInfo().getStatus() == InstanceStatus.DOWN)) {
final Property<Boolean> ignoreAppEurekaStatus = props.get("evcache.ignoreAppEurekaStatus", Boolean.class).orElse(false);

if (ignoreAppEurekaStatus.get())
log.info("Not going to consider the eureka status of the application, to initialize evcache client.");

if (!ignoreAppEurekaStatus.get() && (applicationInfoManager.getInfo().getStatus() == InstanceStatus.DOWN)) {
log.info("Not initializing evcache client as application eureka status is DOWN. " +
"One can override this behavior by setting evcache.ignoreAppEurekaStatus property to true, scoped to your application.");
return Collections.<ServerGroup, EVCacheServerGroupConfig> emptyMap();
}

Expand Down

0 comments on commit 430358d

Please sign in to comment.