Router Extension
Summary
Pick one from service providers and fire the invocation.
Extension Interface
org.apache.dubbo.rpc.cluster.RouterFactory
org.apache.dubbo.rpc.cluster.Router
Existing Extension
org.apache.dubbo.rpc.cluster.router.ScriptRouterFactory
org.apache.dubbo.rpc.cluster.router.FileRouterFactory
org.apache.dubbo.rpc.cluster.router.condition.config.AppRouterFactory
org.apache.dubbo.rpc.cluster.CacheableRouterFactory
org.apache.dubbo.rpc.cluster.router.condition.ConditionRouterFactory
org.apache.dubbo.rpc.cluster.router.mock.MockRouterFactory
org.apache.dubbo.rpc.cluster.router.condition.config.ServiceRouterFactory
org.apache.dubbo.rpc.cluster.router.tag.TagRouterFactory
Extension Guide
Directory layout:
src
|-main
|-java
|-com
|-xxx
|-XxxRouterFactory.java (RouterFactory implementation)
|-resources
|-META-INF
|-dubbo
|-org.apache.dubbo.rpc.cluster.RouterFactory (plain text file with the content: xxx=com.xxx.XxxRouterFactory)
XxxRouterFactory.java:
package com.xxx;
import org.apache.dubbo.rpc.cluster.RouterFactory;
import org.apache.dubbo.rpc.Invoker;
import org.apache.dubbo.rpc.Invocation;
import org.apache.dubbo.rpc.RpcException;
public class XxxRouterFactory implements RouterFactory {
public Router getRouter(URL url) {
// ...
}
}
META-INF/dubbo/org.apache.dubbo.rpc.cluster.RouterFactory:
xxx=com.xxx.XxxRouterFactory
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.
Last modified January 22, 2021: Merge branch 'master' of https://github.com/apache/dubbo-website (f48eac9)