public interface Router extends Comparable<Router>
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_PRIORITY |
| Modifier and Type | Method and Description |
|---|---|
default int |
compareTo(Router o) |
int |
getPriority()
Router's priority, used to sort routers.
|
org.apache.dubbo.common.URL |
getUrl()
Get the router url.
|
boolean |
isForce()
To decide whether this router should take effect when none of the invoker can match the router rule, which
means the
route(List, URL, Invocation) would be empty. |
boolean |
isRuntime()
To decide whether this router need to execute every time an RPC comes or should only execute when addresses or
rule change.
|
default <T> void |
notify(List<Invoker<T>> invokers)
Notify the router the invoker list.
|
<T> List<Invoker<T>> |
route(List<Invoker<T>> invokers,
org.apache.dubbo.common.URL url,
Invocation invocation)
Filter invokers with current routing rule and only return the invokers that comply with the rule.
|
static final int DEFAULT_PRIORITY
org.apache.dubbo.common.URL getUrl()
<T> List<Invoker<T>> route(List<Invoker<T>> invokers, org.apache.dubbo.common.URL url, Invocation invocation) throws RpcException
invokers - invoker listurl - refer urlinvocation - invocationRpcExceptiondefault <T> void notify(List<Invoker<T>> invokers)
route(List, URL, Invocation) gets called.T - invoker's typeinvokers - invoker listboolean isRuntime()
boolean isForce()
route(List, URL, Invocation) would be empty. Most of time, most router implementation would
default this value to false.int getPriority()
default int compareTo(Router o)
compareTo in interface Comparable<Router>Copyright © 2011–2022 The Apache Software Foundation. All rights reserved.