public class ConditionRouter extends AbstractRouter
ServiceRouter
and AppRouter
refer to https://dubbo.apache.org/zh/docs/v2.7/user/examples/routing-rule/ .| Modifier and Type | Field and Description |
|---|---|
static String |
NAME |
DEFAULT_PRIORITY| Constructor and Description |
|---|
ConditionRouter(String rule,
boolean force,
boolean enabled) |
ConditionRouter(org.apache.dubbo.common.URL url) |
| Modifier and Type | Method and Description |
|---|---|
org.apache.dubbo.common.URL |
getUrl()
Get the router url.
|
void |
init(String rule) |
boolean |
isRuntime()
To decide whether this router need to execute every time an RPC comes or should only execute when addresses or
rule change.
|
boolean |
matchArguments(Map.Entry<String,org.apache.dubbo.rpc.cluster.router.condition.ConditionRouter.MatchPair> matchPair,
Invocation invocation)
analysis the arguments in the rule.
|
<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.
|
getPriority, isForce, setForce, setPriority, setUrlpublic static final String NAME
public ConditionRouter(String rule, boolean force, boolean enabled)
public ConditionRouter(org.apache.dubbo.common.URL url)
public void init(String rule)
public <T> List<Invoker<T>> route(List<Invoker<T>> invokers, org.apache.dubbo.common.URL url, Invocation invocation) throws RpcException
Routerinvokers - invoker listurl - refer urlinvocation - invocationRpcExceptionpublic boolean isRuntime()
RouterisRuntime in interface RouterisRuntime in class AbstractRouterpublic org.apache.dubbo.common.URL getUrl()
RoutergetUrl in interface RoutergetUrl in class AbstractRouterpublic boolean matchArguments(Map.Entry<String,org.apache.dubbo.rpc.cluster.router.condition.ConditionRouter.MatchPair> matchPair, Invocation invocation)
matchPair - invocation - Copyright © 2011–2022 The Apache Software Foundation. All rights reserved.