首页  

Dubbo Filter 顺序     所属分类 dubbo 浏览量 77
/META-INF/dubbo/internal/com.alibaba.dubbo.rpc.Filter
monitor=com.alibaba.dubbo.monitor.support.MonitorFilter
validation=com.alibaba.dubbo.validation.filter.ValidationFilter
cache=com.alibaba.dubbo.cache.filter.CacheFilter
trace=com.alibaba.dubbo.rpc.protocol.dubbo.filter.TraceFilter
future=com.alibaba.dubbo.rpc.protocol.dubbo.filter.FutureFilter
echo=com.alibaba.dubbo.rpc.filter.EchoFilter
generic=com.alibaba.dubbo.rpc.filter.GenericFilter
genericimpl=com.alibaba.dubbo.rpc.filter.GenericImplFilter
token=com.alibaba.dubbo.rpc.filter.TokenFilter
accesslog=com.alibaba.dubbo.rpc.filter.AccessLogFilter
activelimit=com.alibaba.dubbo.rpc.filter.ActiveLimitFilter
classloader=com.alibaba.dubbo.rpc.filter.ClassLoaderFilter
context=com.alibaba.dubbo.rpc.filter.ContextFilter
consumercontext=com.alibaba.dubbo.rpc.filter.ConsumerContextFilter
exception=com.alibaba.dubbo.rpc.filter.ExceptionFilter
executelimit=com.alibaba.dubbo.rpc.filter.ExecuteLimitFilter
deprecated=com.alibaba.dubbo.rpc.filter.DeprecatedFilter
compatible=com.alibaba.dubbo.rpc.filter.CompatibleFilter
timeout=com.alibaba.dubbo.rpc.filter.TimeoutFilter

@Activate(group = {Constants.PROVIDER, Constants.CONSUMER})
public class MonitorFilter implements Filter 

@Activate(group = Constants.PROVIDER)
public class TraceFilter implements Filter

@Activate(group = Constants.PROVIDER, value = Constants.ACCESS_LOG_KEY)
public class AccessLogFilter implements Filter 

@Activate(group = Constants.CONSUMER, value = Constants.ACTIVES_KEY)
public class ActiveLimitFilter implements Filter


@Activate(group = Constants.PROVIDER, order = -10000)
public class ContextFilter implements Filter


@Activate(group = Constants.CONSUMER, order = -10000)
public class ConsumerContextFilter implements Filter 


@Activate 注解 
group和order
order 越小,排序越靠前



ProtocolFilterWrapper  构造 Filter链

com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper.buildInvokerChain(Invoker< T >, String, String)


获取激活的filter列表
public List< T > getActivateExtension(URL url, String[] values, String group) 

List filters = ExtensionLoader.getExtensionLoader(Filter.class)
                .getActivateExtension(invoker.getUrl(), key, group);
                
                

配置'-'可以手动剔除Dubbo原生的Filter,default代表Dubbo原生的Filter子链

<dubbo:reference filter="filter1,filter2"/>
原生filter子链->filter1->filter2

<dubbo:reference filter="filter1,filter2,default"/>
filter1->filter2->原生filter子链

<dubbo:service filter="filter1,default,filter2,-token"/>
filter1->原生filter子链->filter2, 同时去掉原生的TokenFilter(token)




上一篇     下一篇
dubbo 分布式追踪 traceId 传递要点

dubbo之RpcContext

dubbo RpcContexta attachments 实例

dubbo 自定义 filter 实例

TBA聊考研

springboot REST api 实例