Sentinel
Sentinel copied to clipboard
some questions while using Sentinel-Zuul-Adapter
Issue Description
feature request
Describe what happened (or what feature you want)
When using Sentinel to protect my zuul gateway, here comes to me some questions.
First of all, I've noticed that GatewayFlowRule
is just an independent class which is not implement the Rule
interface while it should be to do so according to our common understood.
Secondlly, when I'm trying to configure the register2Property
method for each of the 'RuleManagers' such as GatewayRuleManager
,DegradeRuleManager
,and SystemRuleManager
, I found those managers sharing almost the same methods are not extend from any superclasses nor implement any interfaces. So I think common methods should be extracted to make an abstract class or interface then we can get a rather clear view to the family of 'RuleManagers'.
The last thing is, when using Nacos as data persisting tool, I don't know why GatewayFlowManager
is using Set<GatewayFlowRule>
as it's property while other 'Managers' are using List<Rule>
, and I have to set an independent method to grab ReadableDataSource
for GatewayFlowManager only. However, they share exactly the same code but I have to write it twice to meet both Set
and List
results.
第一,感觉GatewayFlowRule
方法应该实现一下Rule
接口
第二,各种RuleManager
类是否可以提一个抽象类出来,这样子可能看起来会更清晰一些
第三,在使用nacos持久化流控配置时,为啥唯独GatewayFlowRule
的property要用Set类型,如此一来当设定网关api的限流,熔断,降级等操作的时候,要为GatewayFlowRule
单独写一个冗余代码块,这里不知道是否可以优化一下...
Describe what you expected to happen
- All the related Rules should be at least an implementation of
Rule
- Managers should have a superclass or interface to extract their sharing methods.
- Make the property type of managers not using different collection type if it is nessessary.
Tell us your environment
JDK 1.8 latest master branch