- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中com.github.dapeng.registry.zookeeper.ZkServiceInfo.routes()
方法的一些代码示例,展示了ZkServiceInfo.routes()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZkServiceInfo.routes()
方法的具体详情如下:
包路径:com.github.dapeng.registry.zookeeper.ZkServiceInfo
类名称:ZkServiceInfo
方法名:routes
[英]路由规则
[中]路由规则
代码示例来源:origin: dapeng-soa/dapeng-soa
/**
* process zk data 解析route 信息
*/
private void processRouteData(ZkServiceInfo serviceInfo, byte[] data) {
try {
String routeData = new String(data, StandardCharsets.UTF_8);
List<Route> zkRoutes = RoutesExecutor.parseAll(routeData);
serviceInfo.routes(zkRoutes);
} catch (Exception e) {
LOGGER.error(getClass() + "::processCookieRuleData, parser routes 信息 失败,请检查路由规则写法是否正确:" + e.getMessage());
}
}
代码示例来源:origin: dapeng-soa/dapeng-soa
/**
* 服务路由
*
* @param serviceInfo
* @param compatibles
* @return
*/
private List<RuntimeInstance> router(ZkServiceInfo serviceInfo, List<RuntimeInstance> compatibles) throws SoaException {
List<Route> routes = serviceInfo.routes();
if (routes == null || routes.size() == 0) {
logger.debug("router 获取 路由信息为空或size为0,跳过router,服务实例数:{}", compatibles.size());
return compatibles;
} else {
InvocationContextImpl context = (InvocationContextImpl) InvocationContextImpl.Factory.currentInstance();
List<RuntimeInstance> runtimeInstances = RoutesExecutor.executeRoutes(context, routes, compatibles);
if (runtimeInstances.size() == 0) {
throw new SoaException(SoaCode.NoMatchedRouting);
}
return runtimeInstances;
}
}
代码示例来源:origin: dapeng-soa/dapeng-soa
/**
* route 根据给定路由规则对可运行实例进行过滤
*/
private void syncZkRouteInfo(ZkServiceInfo serviceInfo) {
LOGGER.warn("ClientZKAgent::syncZkRouteInfo service:" + serviceInfo.serviceName());
String servicePath = ROUTES_PATH + "/" + serviceInfo.serviceName();
int retry = 5;
do {
if (zk == null || !zk.getState().isConnected()) {
LOGGER.warn("ClientZKAgent::syncZkRouteInfo service:"
+ serviceInfo.serviceName() + ", zk status:"
+ (zk == null ? null : zk.getState()) + ", retry:"
+ retry + " times after 300ms");
sleep(300);
} else {
try {
byte[] data = zk.getData(servicePath, this, null);
processRouteData(serviceInfo, data);
LOGGER.warn("ClientZk::getRoutes routes changes:" + serviceInfo.routes());
return;
} catch (KeeperException.NoNodeException e) {
ZkUtils.createPersistNodeOnly(servicePath, zk);
} catch (KeeperException | InterruptedException e) {
LOGGER.error(getClass() + "::syncZkRouteInfo serviceName: " + serviceInfo.serviceName() + " 出现异常, zkStatus:" + zk.getState(), e);
sleep(300);
}
}
} while (--retry > 0);
}
本文整理了Java中com.github.dapeng.registry.zookeeper.ZkServiceInfo类的一些代码示例,展示了ZkServiceInfo类的具体用法。这些代码示例主要
本文整理了Java中com.github.dapeng.registry.zookeeper.ZkServiceInfo.serviceName()方法的一些代码示例,展示了ZkServiceInfo
本文整理了Java中com.github.dapeng.registry.zookeeper.ZkServiceInfo.runtimeInstances()方法的一些代码示例,展示了ZkServic
本文整理了Java中com.github.dapeng.registry.zookeeper.ZkServiceInfo.freqControl()方法的一些代码示例,展示了ZkServiceInfo
本文整理了Java中com.github.dapeng.registry.zookeeper.ZkServiceInfo.routes()方法的一些代码示例,展示了ZkServiceInfo.rout
本文整理了Java中com.github.dapeng.registry.zookeeper.ZkServiceInfo.()方法的一些代码示例,展示了ZkServiceInfo.()的具体用法。这些
本文整理了Java中com.github.dapeng.registry.zookeeper.ZkServiceInfo.cookieRules()方法的一些代码示例,展示了ZkServiceInfo
我是一名优秀的程序员,十分优秀!