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.
- Update document for Dubbo demo - Update document for extensions Signed-off-by: Eric Zhao <sczyh16@gmail.com>
- Loading branch information
Showing
5 changed files
with
79 additions
and
8 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,6 @@ | ||
# Sentinel Extension | ||
|
||
This is the parent of all extension points to Sentinel. | ||
|
||
Examples of what makes sense as a extension submodule are: | ||
|
||
* alternate implementations rules config | ||
Sentinel extension modules provide additional extension points | ||
and functions. | ||
|
||
|
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,27 @@ | ||
# Sentinel DataSource Nacos | ||
|
||
Sentinel DataSource Nacos provides integration with [Nacos](http://nacos.io) so that Nacos | ||
can be the dynamic rule data source of Sentinel. | ||
|
||
To use Sentinel DataSource Nacos, you should add the following dependency: | ||
|
||
```xml | ||
<dependency> | ||
<groupId>com.alibaba.csp</groupId> | ||
<artifactId>sentinel-datasource-nacos</artifactId> | ||
<version>x.y.z</version> | ||
</dependency> | ||
``` | ||
|
||
Then you can create an `NacosDataSource` and register to rule managers. | ||
For instance: | ||
|
||
```java | ||
// remoteAddress is the address of Nacos | ||
// groupId and dataId are concepts of Nacos | ||
DataSource<String, List<FlowRule>> flowRuleDataSource = new NacosDataSource<>(remoteAddress, groupId, dataId, | ||
source -> JSON.parseObject(source, new TypeReference<List<FlowRule>>() {})); | ||
FlowRuleManager.register2Property(flowRuleDataSource.getProperty()); | ||
``` | ||
|
||
We've also provided an example: [sentinel-demo-nacos-datasource](https://github.com/alibaba/Sentinel/tree/master/sentinel-demo/sentinel-demo-nacos-datasource). |
27 changes: 27 additions & 0 deletions
27
sentinel-extension/sentinel-datasource-zookeeper/README.md
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,27 @@ | ||
# Sentinel DataSource ZooKeeper | ||
|
||
Sentinel DataSource ZooKeeper provides integration with ZooKeeper so that ZooKeeper | ||
can be the dynamic rule data source of Sentinel. The data source uses push model (listener). | ||
|
||
To use Sentinel DataSource ZooKeeper, you should add the following dependency: | ||
|
||
```xml | ||
<dependency> | ||
<groupId>com.alibaba.csp</groupId> | ||
<artifactId>sentinel-datasource-zookeeper</artifactId> | ||
<version>x.y.z</version> | ||
</dependency> | ||
``` | ||
|
||
Then you can create an `ZookeeperDataSource` and register to rule managers. | ||
For instance: | ||
|
||
```java | ||
// `path` is the data path in ZooKeeper | ||
DataSource<String, List<FlowRule>> flowRuleDataSource = new ZookeeperDataSource<>(remoteAddress, path, source -> JSON.parseObject(source, new TypeReference<List<FlowRule>>() {})); | ||
FlowRuleManager.register2Property(flowRuleDataSource.getProperty()); | ||
``` | ||
|
||
> Note: It's not recommended to add a large amount of rules to a single path (has limitation, also leads to bad performance). | ||
We've also provided an example: [sentinel-demo-zookeeper-datasource](https://github.com/alibaba/Sentinel/tree/master/sentinel-demo/sentinel-demo-zookeeper-datasource). |