com.nepxion.discovery.plugin.framework.adapter.EurekaAdapter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of discovery-plugin-framework-eureka Show documentation
Show all versions of discovery-plugin-framework-eureka Show documentation
Nepxion Discovery is an enhancement for Spring Cloud Discovery
package com.nepxion.discovery.plugin.framework.adapter;
/**
* Title: Nepxion Discovery
* Description: Nepxion Discovery
* Copyright: Copyright (c) 2017-2050
* Company: Nepxion
* @author Haojun Ren
* @version 1.0
*/
import java.util.Map;
import com.nepxion.discovery.common.exception.DiscoveryException;
import com.netflix.loadbalancer.Server;
import com.netflix.niws.loadbalancer.DiscoveryEnabledServer;
public class EurekaAdapter extends AbstractPluginAdapter {
@Override
public Map getServerMetadata(Server server) {
if (server instanceof DiscoveryEnabledServer) {
DiscoveryEnabledServer discoveryEnabledServer = (DiscoveryEnabledServer) server;
return discoveryEnabledServer.getInstanceInfo().getMetadata();
}
throw new DiscoveryException("Server instance isn't the type of DiscoveryEnabledServer");
}
}