Sentinel/sentinel-extension/sentinel-datasource-consul
Eric Zhao 2682bd1aae Improve ConsulDataSource and add README.md for the module
- Change the unit of waitTimeout from ms to s (the previous implementation lay suffer the bug that ms/1000=0 when ms<=1000)
- Improve the error handling when parsing the value
- Add README.md

Signed-off-by: Eric Zhao <sczyh16@gmail.com>
2019-08-14 20:34:34 +08:00
..
src Improve ConsulDataSource and add README.md for the module 2019-08-14 20:34:34 +08:00
README.md Improve ConsulDataSource and add README.md for the module 2019-08-14 20:34:34 +08:00
pom.xml Add Consul DataSource integration module (#979) 2019-08-14 10:38:57 +08:00

README.md

Sentinel DataSource Consul

Sentinel DataSource Consul provides integration with Consul. The data source leverages blocking query (backed by long polling) of Consul.

NOTE: This module requires JDK 1.8 or later.

Usage

To use Sentinel DataSource Consul, you could add the following dependency:

<dependency>
    <groupId>com.alibaba.csp</groupId>
    <artifactId>sentinel-datasource-consul</artifactId>
    <version>x.y.z</version>
</dependency>

Then you can create a ConsulDataSource and register to rule managers. For instance:

ReadableDataSource<String, List<FlowRule>> dataSource = new ConsulDataSource<>(host, port, ruleKey, waitTimeoutInSecond, flowConfigParser);
FlowRuleManager.register2Property(dataSource.getProperty());
  • ruleKey: the rule persistence key
  • waitTimeoutInSecond: long polling timeout (in second) of the Consul API client