Commit 4e35f772 by Nepxion

增加基于Region的权重流量策略

parent a725760b
...@@ -9,6 +9,7 @@ package com.nepxion.discovery.plugin.example.service.feign; ...@@ -9,6 +9,7 @@ package com.nepxion.discovery.plugin.example.service.feign;
* @version 1.0 * @version 1.0
*/ */
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import com.nepxion.discovery.plugin.framework.adapter.PluginAdapter; import com.nepxion.discovery.plugin.framework.adapter.PluginAdapter;
...@@ -19,10 +20,21 @@ public class AbstractFeignImpl { ...@@ -19,10 +20,21 @@ public class AbstractFeignImpl {
public String doInvoke(String value) { public String doInvoke(String value) {
String serviceId = pluginAdapter.getServiceId(); String serviceId = pluginAdapter.getServiceId();
String host = pluginAdapter.getHost();
int port = pluginAdapter.getPort();
String version = pluginAdapter.getVersion(); String version = pluginAdapter.getVersion();
// String host = pluginAdapter.getHost(); String region = pluginAdapter.getRegion();
// int port = pluginAdapter.getPort();
return value + " -> " + serviceId + "[" + version + "]"; StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append(value + " -> " + serviceId);
stringBuilder.append("[" + host + ":" + port + "]");
if (StringUtils.isNotEmpty(version)) {
stringBuilder.append("[V" + version + "]");
}
if (StringUtils.isNotEmpty(region)) {
stringBuilder.append("[Region=" + region + "]");
}
return stringBuilder.toString();
} }
} }
\ No newline at end of file
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