gougouzcm commented on issue #1669: How can I know where I am called in a Router URL: https://github.com/apache/incubator-dubbo/issues/1669#issuecomment-384837642 @beiwei30 ``` public List<Invoker<T>> list(Invocation invocation) throws RpcException { if (destroyed) { throw new RpcException("Directory already destroyed .url: " + getUrl()); } List<Invoker<T>> invokers = doList(invocation); List<Router> localRouters = this.routers; // local reference if (localRouters != null && localRouters.size() > 0) { for (Router router : localRouters) { try { if (router.getUrl() == null || router.getUrl().getParameter(Constants.RUNTIME_KEY, false)) { invokers = router.route(invokers, getConsumerUrl(), invocation); } } catch (Throwable t) { logger.error("Failed to execute router: " + getUrl() + ", cause: " + t.getMessage(), t); } } } return invokers; } ``` I put the param Constants.RUNTIME_KEY true in url, so the router will be called every rpc request。 `RpcGrayContext.getGrayGroup()` was put in a web filter / or the `<dubbo:provider filter=grayFilter>` , It will be clean and set at that time 。 First , In my test , if ` router.getUrl().getParameter(Constants.RUNTIME_KEY, false) == true` , the router will be called every time. I had got a idea how to add grayRouter in [1622](https://github.com/apache/incubator-dubbo/issues/1622)。 The [conditional routing](http://dubbo.apache.org/books/dubbo-user-book/demos/routing-rule.html) is too complex for deal with gray request. many interface, many configures, and can't dynamic route gray request in One application.
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
