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.
|
default <T> List<Invoker<T>> |
route(List<Invoker<T>> invokers,
org.apache.dubbo.common.URL url,
Invocation invocation)
Deprecated.
|
default <T> RouterResult<Invoker<T>> |
route(List<Invoker<T>> invokers,
org.apache.dubbo.common.URL url,
Invocation invocation,
boolean needToPrintMessage)
** This method can return the state of whether routerChain needed to continue route.
|
default void |
stop() |
static final int DEFAULT_PRIORITY
org.apache.dubbo.common.URL getUrl()
@Deprecated default <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> RouterResult<Invoker<T>> route(List<Invoker<T>> invokers, org.apache.dubbo.common.URL url, Invocation invocation, boolean needToPrintMessage) throws RpcException
invokers - invoker listurl - refer urlinvocation - invocationneedToPrintMessage - whether to print router state. Such as `use router branch a`.RpcExceptiondefault <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 void stop()
default int compareTo(Router o)
compareTo in interface Comparable<Router>Copyright © 2011–2022 The Apache Software Foundation. All rights reserved.