Hi, community. This mail is related to this issue.A simple and incomplete
TagRouter has merged into dubbo v2.7.0-snapshot??in this mail??i will introduce
what problem did it solve. At the end of the letter, i want to refer to your
opinion and proposal, decide the final behavior of TagRouter .
What is TagRouter
TagRouter is a new implement of Router interface, other exsiting Router :
ConditionRouter, ScriptRouter, FileRouter.
It makes any request can carry a request.tag and any service belong to a
certain tagTag will affect the default route behavior.
Some pain points in the past
fact1: some applications changed at the same time in different branch,like
A,B,C.fact2: some applications didn't change ,but deploy repeatedly??like
D,E.fact3: if a new feature need to be tested, all 5 application need to be
deployed.fact4: isolation by feature is not friendly to parallel development.
Benefited from tag
we consider the RED??YELLOW??BLUE as tagged service , the grey block as origin
service or normal service.
The benefit we have is that we have reduced a lot of overhead about application
deployment. Only changed applications need deploy incrementally .
A vivid example
Usage
consumer
RpcContext.getContext().setAttachment("request.tag","red");
I suggest you can use filter or SPI to set this attachment, notice that
RpcContext is bound to Thread.
provider
@Bean
public ApplicationConfig applicationConfig() {
ApplicationConfig applicationConfig = new ApplicationConfig();
applicationConfig.setName("provider-book");
// instruct tag router
Map<String,String> parameters = new HashMap<>();
parameters.put(Constants.ROUTER_KEY, "tag");
applicationConfig.setParameters(parameters);
return applicationConfig;
}
Need more discussion
If a tag request can not find any application of the same tag??should it use
other application of different tag (NOTICE : different tag is not the default
application with grey block)
If a normal request can not find normal application??should it use any tag
application?(in my opinion??normal request should not reach the tag
application??also the current version).
A forceTag flag can be considered to decided the behavior of downgrade.
forceTag=true means all tag requests must strictly match the application's
tag??forceTag=false means tag requests will prefer the application of the same
tag??if there is no corresponding application?? downgrade to other
application??ignore the tag.
On the basis of 3. what is default value of foreTag TRUE or FALSE.
more suggestions are welcome to make.