@SPI(scope=MODULE) public interface Filter extends BaseFilter
They way filter work from sequence point of view is
...code before filter ...
invoker.invoke(invocation) //filter work in a filter implementation class
...code after filter ...
Caching is implemented in dubbo using filter approach. If cache is configured for invocation then before
remote call configured caching type's (e.g. Thread Local, JCache etc) implementation invoke method gets called.
Starting from 3.0, Filter on consumer side has been refactored. There are two different kinds of Filters working at different stages
of an RPC request.
1. Filter. Works at the instance level, each Filter is bond to one specific Provider instance(invoker).
2. ClusterFilter. Newly introduced in 3.0, intercepts request before Loadbalancer picks one specific Filter(Invoker).
Filter Chain in 3.x
-> Filter -> Invoker
Proxy -> ClusterFilter -> ClusterInvoker -> Filter -> Invoker
-> Filter -> Invoker
Filter Chain in 2.x
Filter -> Invoker
Proxy -> ClusterInvoker -> Filter -> Invoker
Filter -> Invoker
Filter. (SPI, Singleton, ThreadSafe)GenericFilter,
EchoFilter,
TokenFilter,
TpsLimitFilterBaseFilter.ListenerinvokeCopyright © 2011–2020 The Apache Software Foundation. All rights reserved.