public interface StateRouter<T>
Routing
It is recommended to implement StateRouter by extending AbstractStateRouter
Cluster.join(Directory, boolean),
AbstractStateRouter,
Directory.list(Invocation)| Modifier and Type | Method and Description |
|---|---|
String |
buildSnapshot()
Build Router's Current State Snapshot for QoS
|
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(BitList, URL, Invocation, boolean, Holder) 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.
|
void |
notify(BitList<Invoker<T>> invokers)
Notify the router the invoker list.
|
BitList<Invoker<T>> |
route(BitList<Invoker<T>> invokers,
org.apache.dubbo.common.URL url,
Invocation invocation,
boolean needToPrintMessage,
org.apache.dubbo.common.utils.Holder<RouterSnapshotNode<T>> nodeHolder)
Filter invokers with current routing rule and only return the invokers that comply with the rule.
|
void |
setNextRouter(StateRouter<T> nextRouter)
Notify next router node to current router.
|
default void |
stop() |
org.apache.dubbo.common.URL getUrl()
BitList<Invoker<T>> route(BitList<Invoker<T>> invokers, org.apache.dubbo.common.URL url, Invocation invocation, boolean needToPrintMessage, org.apache.dubbo.common.utils.Holder<RouterSnapshotNode<T>> nodeHolder) throws RpcException
invokers - invoker bit listurl - refer urlinvocation - invocationneedToPrintMessage - whether to print router state. Such as `use router branch a`.RpcExceptionboolean isRuntime()
boolean isForce()
route(BitList, URL, Invocation, boolean, Holder) would be empty. Most of time, most router implementation would
default this value to false.void notify(BitList<Invoker<T>> invokers)
route(BitList, URL, Invocation, boolean, Holder) gets called.
No need to notify next node.invokers - invoker listString buildSnapshot()
default void stop()
void setNextRouter(StateRouter<T> nextRouter)
nextRouter - next router nodeCopyright © 2011–2022 The Apache Software Foundation. All rights reserved.