Commit 8fa9b715 by Darek Kaczyński

Corrected example of providing Turbine cluster name via instance metadata map.

parent 532cfd9b
...@@ -517,7 +517,7 @@ turbine: ...@@ -517,7 +517,7 @@ turbine:
aggregator: aggregator:
clusterConfig: SYSTEM,USER clusterConfig: SYSTEM,USER
appConfig: customers,stores,ui,admin appConfig: customers,stores,ui,admin
clusterNameExpression: metadata.cluster clusterNameExpression: metadata['cluster']
---- ----
In this case, the cluster name from 4 services is pulled from their metadata map, and is expected to have values that include "SYSTEM" and "USER". In this case, the cluster name from 4 services is pulled from their metadata map, and is expected to have values that include "SYSTEM" and "USER".
......
...@@ -50,4 +50,16 @@ public class EurekaInstanceDiscoveryTest { ...@@ -50,4 +50,16 @@ public class EurekaInstanceDiscoveryTest {
assertEquals("clusterName is wrong", asgName, clusterName); assertEquals("clusterName is wrong", asgName, clusterName);
} }
@Test
public void testGetClusterNameInstanceMetadataMapExpression() {
TurbineProperties turbineProperties = new TurbineProperties();
turbineProperties.setClusterNameExpression("metadata['cluster']");
EurekaInstanceDiscovery discovery = new EurekaInstanceDiscovery(turbineProperties);
String metadataProperty = "myCluster";
InstanceInfo instanceInfo = InstanceInfo.Builder.newBuilder()
.setAppName("testApp").add("cluster", metadataProperty).build();
String clusterName = discovery.getClusterName(instanceInfo);
assertEquals("clusterName is wrong", metadataProperty, clusterName);
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment