forked from alibaba/Sentinel
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 <[email protected]>
- Loading branch information
Showing
3 changed files
with
127 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# 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: | ||
|
||
```xml | ||
<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: | ||
|
||
```java | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters