Sentinel/sentinel-extension/sentinel-datasource-nacos
LearningGp eb3a9b099a
Bump version to 1.8.9 (#3566)
* chore: update release configuration

* Bump version to 1.8.9
2025-10-16 20:26:58 +08:00
..
src/main/java/com/alibaba/csp/sentinel/datasource/nacos Fix potential connection leak bug when closing NacosDataSource (#2962) 2023-12-27 20:40:26 +08:00
README.md Move document-lint from circleci to github-actions (#3345) 2024-02-21 17:05:29 +08:00
pom.xml Bump version to 1.8.9 (#3566) 2025-10-16 20:26:58 +08:00

README.md

Sentinel DataSource Nacos

Sentinel DataSource Nacos provides integration with Nacos so that Nacos can be the dynamic rule data source of Sentinel.

To use Sentinel DataSource Nacos, you should add the following dependency:

<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:

// remoteAddress is the address of Nacos
// groupId and dataId are concepts of Nacos
ReadableDataSource<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.