com.alibaba.csp.sentinel.cluster.client.config.ClusterClientConfig Java Examples

The following examples show how to use com.alibaba.csp.sentinel.cluster.client.config.ClusterClientConfig. 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
/**
 * 加载集群客户端配置
 * 主要是集群服务端的相关连接信息
 */
private void loadClusterClientConfig(){
    ClusterClientAssignConfig assignConfig = new ClusterClientAssignConfig();
    assignConfig.setServerHost(CLUSTER_SERVER_HOST);
    assignConfig.setServerPort(CLUSTER_SERVER_PORT);
    ClusterClientConfigManager.applyNewAssignConfig(assignConfig);

    ClusterClientConfig clientConfig = new ClusterClientConfig();
    clientConfig.setRequestTimeout(REQUEST_TIME_OUT);
    ClusterClientConfigManager.applyNewConfig(clientConfig);
}
 
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: ClusterFlowClientController.java    From sentinel-tutorial with Apache License 2.0 5 votes vote down vote up
/**
 * 加载集群客户端配置
 * 主要是集群服务端的相关连接信息
 */
private void loadClusterClientConfig(){
    ClusterClientAssignConfig assignConfig = new ClusterClientAssignConfig();
    assignConfig.setServerHost(CLUSTER_SERVER_HOST);
    assignConfig.setServerPort(CLUSTER_SERVER_PORT);
    ClusterClientConfigManager.applyNewAssignConfig(assignConfig);

    ClusterClientConfig clientConfig = new ClusterClientConfig();
    clientConfig.setRequestTimeout(REQUEST_TIME_OUT);
    ClusterClientConfigManager.applyNewConfig(clientConfig);
}
 
Example #4
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 #5
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 #6
Source File: ClusterClientStateEntity.java    From Sentinel-Dashboard-Nacos with Apache License 2.0 4 votes vote down vote up
public ClusterClientConfig toClientConfig() {
    return new ClusterClientConfig().setRequestTimeout(requestTimeout);
}
 
Example #7
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());
}
 
Example #8
Source File: ClusterClientStateEntity.java    From Sentinel with Apache License 2.0 4 votes vote down vote up
public ClusterClientConfig toClientConfig() {
    return new ClusterClientConfig().setRequestTimeout(requestTimeout);
}