public class CommonsInstanceDiscovery extends Object implements com.netflix.turbine.discovery.InstanceDiscovery
InstanceDiscovery
implementation that uses Spring Cloud Commons (see https://github.com/spring-cloud/spring-cloud-commons)
The plugin requires a list of applications configured. It then queries the set of
instances for * each application. Instance information retrieved from the DiscoveryClient
must be translated to * something that Turbine can understand i.e the
Instance class.
All the logic to perform this translation can be overriden here, so that you can provide your own implementation if needed.
| Modifier and Type | Field and Description |
|---|---|
protected static String |
FUSED_HOST_PORT_KEY |
protected static String |
PORT_KEY |
protected static String |
SECURE_PORT_KEY |
| Modifier | Constructor and Description |
|---|---|
|
CommonsInstanceDiscovery(TurbineProperties turbineProperties,
org.springframework.cloud.client.discovery.DiscoveryClient discoveryClient) |
protected |
CommonsInstanceDiscovery(TurbineProperties turbineProperties,
String defaultExpression) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addMetadata(com.netflix.turbine.discovery.Instance instance,
String hostname,
String port,
boolean securePortEnabled,
String securePort,
Map<String,String> metadata) |
protected String |
getClusterName(Object object)
Helper that fetches the cluster name.
|
protected org.springframework.expression.Expression |
getClusterNameExpression() |
protected com.netflix.turbine.discovery.Instance |
getInstance(String hostname,
String port,
String cluster,
Boolean status) |
Collection<com.netflix.turbine.discovery.Instance> |
getInstanceList()
Method that queries DiscoveryClient for a list of configured application names
|
protected List<com.netflix.turbine.discovery.Instance> |
getInstancesForApp(String serviceId)
helper that fetches the Instances for each application from DiscoveryClient.
|
TurbineProperties |
getTurbineProperties() |
protected boolean |
isCombineHostPort() |
protected static final String PORT_KEY
protected static final String SECURE_PORT_KEY
protected static final String FUSED_HOST_PORT_KEY
public CommonsInstanceDiscovery(TurbineProperties turbineProperties, org.springframework.cloud.client.discovery.DiscoveryClient discoveryClient)
protected CommonsInstanceDiscovery(TurbineProperties turbineProperties, String defaultExpression)
protected org.springframework.expression.Expression getClusterNameExpression()
public TurbineProperties getTurbineProperties()
protected boolean isCombineHostPort()
public Collection<com.netflix.turbine.discovery.Instance> getInstanceList() throws Exception
getInstanceList in interface com.netflix.turbine.discovery.InstanceDiscoveryExceptionprotected List<com.netflix.turbine.discovery.Instance> getInstancesForApp(String serviceId) throws Exception
serviceId - Exceptionprotected void addMetadata(com.netflix.turbine.discovery.Instance instance,
String hostname,
String port,
boolean securePortEnabled,
String securePort,
Map<String,String> metadata)
protected com.netflix.turbine.discovery.Instance getInstance(String hostname, String port, String cluster, Boolean status)
Copyright © 2017 Pivotal Software, Inc.. All rights reserved.