You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "liunancun (GitHub)" <gi...@apache.org> on 2020/03/28 00:32:53 UTC

[GitHub] [dubbo] liunancun opened issue #5932: 按照路由扩展的文档自定义路由后,怎么让路由生效,是不是要往注册中心写一些东西,这部分在文档里没有说明

按照路由扩展的文档自定义路由后,怎么让路由生效,是不是要往注册中心写一些东西,这部分在文档里没有说明

[ Full content available at: https://github.com/apache/dubbo/issues/5932 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org

[GitHub] [dubbo] lishun888 commented on issue #5932: 按照路由扩展的文档自定义路由后,怎么让路由生效,是不是要往注册中心写一些东西,这部分在文档里没有说明

Posted by "lishun888 (GitHub)" <gi...@apache.org>.
String routerkey = url.getParameter(Constants.ROUTER_KEY);
        if (routerkey != null && routerkey.length() > 0) {
            RouterFactory routerFactory = ExtensionLoader.getExtensionLoader(RouterFactory.class).getExtension(routerkey);
            routers.add(routerFactory.getRouter(url));
        }

源码上是要求从zk url获取参数的,这块不知道要怎么处理

[ Full content available at: https://github.com/apache/dubbo/issues/5932 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org

[GitHub] [dubbo] RojerAlone commented on issue #5932: 按照路由扩展的文档自定义路由后,怎么让路由生效,是不是要往注册中心写一些东西,这部分在文档里没有说明

Posted by "RojerAlone (GitHub)" <gi...@apache.org>.
@liunancun 两种办法:
1. 查找官方文档,不过我以前找过没找到,或者你直接看代码是否有相关逻辑,我在 `RouterChain` 中没找到
2. 在你的 Router 中配置,根据请求信息判断是否进行路由操作

[ Full content available at: https://github.com/apache/dubbo/issues/5932 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org

[GitHub] [dubbo] liunancun commented on issue #5932: 按照路由扩展的文档自定义路由后,怎么让路由生效,是不是要往注册中心写一些东西,这部分在文档里没有说明

Posted by "liunancun (GitHub)" <gi...@apache.org>.
现在是加了@Activate注解,如果只想对部分服务生效可以配置吗,现在所有服务调用都经过这个路由

[ Full content available at: https://github.com/apache/dubbo/issues/5932 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org

[GitHub] [dubbo] lishun888 commented on issue #5932: 按照路由扩展的文档自定义路由后,怎么让路由生效,是不是要往注册中心写一些东西,这部分在文档里没有说明

Posted by "lishun888 (GitHub)" <gi...@apache.org>.
目前按照上面说的配置,还是没有生效

[ Full content available at: https://github.com/apache/dubbo/issues/5932 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org

[GitHub] [dubbo] bigbang555 commented on issue #5932: 按照路由扩展的文档自定义路由后,怎么让路由生效,是不是要往注册中心写一些东西,这部分在文档里没有说明

Posted by "bigbang555 (GitHub)" <gi...@apache.org>.
配置了路由的话,在对应/duubo/xxx.xxx.XxxService/routers下会有相应的节点生成的

[ Full content available at: https://github.com/apache/dubbo/issues/5932 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org