Java Code Examples for com.alibaba.csp.sentinel.cluster.client.config.ClusterClientConfigManager#registerClientConfigProperty()

The following examples show how to use com.alibaba.csp.sentinel.cluster.client.config.ClusterClientConfigManager#registerClientConfigProperty() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ClusterFlowClientController.java    From sentinel-tutorial with Apache License 2.0 5 votes vote down vote up
/**
 * 为ClusterClientConfig注册一个SentinelProperty
 * 这样的话可以动态的更改这些配置
 */
private void registerClusterClientProperty() {
    String clientConfigDataId = "cluster-client-config";
    // 初始化一个配置ClusterClientConfig的 Nacos 数据源
    ReadableDataSource<String, ClusterClientConfig> clientConfigDS = new NacosDataSource<>(REMOTE_ADDRESS, GROUP_ID, clientConfigDataId,
            source -> JSON.parseObject(source, new TypeReference<ClusterClientConfig>() {}));
    ClusterClientConfigManager.registerClientConfigProperty(clientConfigDS.getProperty());

    String clientAssignConfigDataId = "cluster-client-assign-config";
    // 初始化一个配置ClusterClientAssignConfig的 Nacos 数据源
    ReadableDataSource<String, ClusterClientAssignConfig> clientAssignConfigDS = new NacosDataSource<>(REMOTE_ADDRESS, GROUP_ID, clientAssignConfigDataId,
            source -> JSON.parseObject(source, new TypeReference<ClusterClientAssignConfig>() {}));
    ClusterClientConfigManager.registerServerAssignProperty(clientAssignConfigDS.getProperty());
}
 
Example 2
Source File: ClusterFlowClientController.java    From sentinel-tutorial with Apache License 2.0 5 votes vote down vote up
/**
 * 为ClusterClientConfig注册一个SentinelProperty
 * 这样的话可以动态的更改这些配置
 */
private void registerClusterClientProperty() {
    String clientConfigDataId = "cluster-client-config";
    // 初始化一个配置ClusterClientConfig的 Nacos 数据源
    ReadableDataSource<String, ClusterClientConfig> clientConfigDS = new NacosDataSource<>(REMOTE_ADDRESS, GROUP_ID, clientConfigDataId,
            source -> JSON.parseObject(source, new TypeReference<ClusterClientConfig>() {}));
    ClusterClientConfigManager.registerClientConfigProperty(clientConfigDS.getProperty());

    String clientAssignConfigDataId = "cluster-client-assign-config";
    // 初始化一个配置ClusterClientAssignConfig的 Nacos 数据源
    ReadableDataSource<String, ClusterClientAssignConfig> clientAssignConfigDS = new NacosDataSource<>(REMOTE_ADDRESS, GROUP_ID, clientAssignConfigDataId,
            source -> JSON.parseObject(source, new TypeReference<ClusterClientAssignConfig>() {}));
    ClusterClientConfigManager.registerServerAssignProperty(clientAssignConfigDS.getProperty());

}
 
Example 3
Source File: DemoClusterInitFunc.java    From Sentinel-Dashboard-Nacos with Apache License 2.0 4 votes vote down vote up
private void initClientConfigProperty() {
    ReadableDataSource<String, ClusterClientConfig> clientConfigDs = new NacosDataSource<>(remoteAddress, groupId,
        configDataId, source -> JSON.parseObject(source, new TypeReference<ClusterClientConfig>() {}));
    ClusterClientConfigManager.registerClientConfigProperty(clientConfigDs.getProperty());
}
 
Example 4
Source File: DemoClusterInitFunc.java    From Sentinel with Apache License 2.0 4 votes vote down vote up
private void initClientConfigProperty() {
    ReadableDataSource<String, ClusterClientConfig> clientConfigDs = new NacosDataSource<>(remoteAddress, groupId,
        configDataId, source -> JSON.parseObject(source, new TypeReference<ClusterClientConfig>() {}));
    ClusterClientConfigManager.registerClientConfigProperty(clientConfigDs.getProperty());
}