Interface GovernanceRuleRepository
- All Known Implementing Classes:
DefaultGovernanceRuleRepositoryImpl
@SPI(value="default",
scope=MODULE)
public interface GovernanceRuleRepository
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidaddListener(String key, String group, org.apache.dubbo.common.config.configcenter.ConfigurationListener listener) Register a configuration listener for a specified key The listener only works for service governance purpose, so the target group would always be the value user specifies at startup or 'dubbo' by default.default voidaddListener(String key, org.apache.dubbo.common.config.configcenter.ConfigurationListener listener) default StringGet the governance rule mapped to the given key and the given groupGet the governance rule mapped to the given key and the given group.voidremoveListener(String key, String group, org.apache.dubbo.common.config.configcenter.ConfigurationListener listener) Stops one listener from listening to value changes in the specified key.default voidremoveListener(String key, org.apache.dubbo.common.config.configcenter.ConfigurationListener listener)
-
Field Details
-
DEFAULT_GROUP
- See Also:
-
-
Method Details
-
addListener
default void addListener(String key, org.apache.dubbo.common.config.configcenter.ConfigurationListener listener) - Parameters:
key- the key to represent a configurationlistener- configuration listener
-
removeListener
default void removeListener(String key, org.apache.dubbo.common.config.configcenter.ConfigurationListener listener) - Parameters:
key- the key to represent a configurationlistener- configuration listener
-
addListener
void addListener(String key, String group, org.apache.dubbo.common.config.configcenter.ConfigurationListener listener) Register a configuration listener for a specified key The listener only works for service governance purpose, so the target group would always be the value user specifies at startup or 'dubbo' by default. This method will only register listener, which means it will not trigger a notification that contains the current value.- Parameters:
key- the key to represent a configurationgroup- the group where the key belongs tolistener- configuration listener
-
removeListener
void removeListener(String key, String group, org.apache.dubbo.common.config.configcenter.ConfigurationListener listener) Stops one listener from listening to value changes in the specified key.- Parameters:
key- the key to represent a configurationgroup- the group where the key belongs tolistener- configuration listener
-
getRule
Get the governance rule mapped to the given key and the given group- Parameters:
key- the key to represent a configurationgroup- the group where the key belongs to- Returns:
- target configuration mapped to the given key and the given group
-
getRule
Get the governance rule mapped to the given key and the given group. If the rule fails to return after timeout exceeds, IllegalStateException will be thrown.- Parameters:
key- the key to represent a configurationgroup- the group where the key belongs totimeout- timeout value for fetching the target config- Returns:
- target configuration mapped to the given key and the given group, IllegalStateException will be thrown if timeout exceeds.
- Throws:
IllegalStateException
-