java.lang.Object
org.miaixz.bus.limiter.Registry
Manages the registration of various limiting and protection rules, such as downgrade, hotspot, and request limiting.
This class interacts with Sentinel's
FlowRuleManager to configure flow control rules dynamically.- Since:
- Java 17+
- Author:
- Kimi Liu
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Registry
public Registry()
-
-
Method Details
-
register
Registers a downgrade rule based on the providedDowngradeannotation. If a flow rule for the given resource key does not already exist, a newFlowRuleis created with the specified grade and count, and then loaded into Sentinel'sFlowRuleManager.- Parameters:
downgrade- TheDowngradeannotation containing the downgrade configuration.resourceKey- The unique identifier for the resource to which the downgrade rule applies.
-
register
Registers a hotspot rule based on the providedHotspotannotation. If a flow rule for the given resource key does not already exist, a newFlowRuleis created with the specified grade and count. Note that Sentinel versions like 1.8.8 might not fully support hotspot parameter flow control directly, and it might be simplified to a regular flow control rule.- Parameters:
hotspot- TheHotspotannotation containing the hotspot configuration.resourceKey- The unique identifier for the resource to which the hotspot rule applies.
-
register
Registers a request limiting rule based on the providedLimitingannotation. If a flow rule for the given resource key does not already exist, a newFlowRuleis created with a default QPS grade and the specified count, then loaded into Sentinel'sFlowRuleManager.- Parameters:
limiting- TheLimitingannotation containing the limiting configuration.resourceKey- The unique identifier for the resource to which the limiting rule applies.
-