Search in sources :

Example 1 with KieConfiguration

use of org.apache.servicecomb.config.kie.client.model.KieConfiguration in project java-chassis by ServiceComb.

the class KieConfigurationSourceImpl method init.

@Override
public void init(Configuration localConfiguration) {
    configConverter = new ConfigConverter(KieConfig.INSTANCE.getFileSources());
    KieAddressManager kieAddressManager = configKieAddressManager();
    RequestConfig.Builder requestBuilder = HttpTransportFactory.defaultRequestConfig();
    if (KieConfig.INSTANCE.enableLongPolling() && KieConfig.INSTANCE.getPollingWaitTime() >= 0) {
        requestBuilder.setConnectionRequestTimeout(KieConfig.INSTANCE.getPollingWaitTime() * 2 * 1000);
        requestBuilder.setSocketTimeout(KieConfig.INSTANCE.getPollingWaitTime() * 2 * 1000);
    }
    HttpTransport httpTransport = createHttpTransport(kieAddressManager, requestBuilder.build(), localConfiguration);
    KieConfiguration kieConfiguration = createKieConfiguration();
    KieClient kieClient = new KieClient(kieAddressManager, httpTransport, kieConfiguration);
    EventManager.register(this);
    kieConfigManager = new KieConfigManager(kieClient, EventManager.getEventBus(), kieConfiguration, configConverter);
    kieConfigManager.firstPull();
    kieConfigManager.startConfigKieManager();
    updateConfiguration(WatchedUpdateResult.createIncremental(configConverter.getCurrentData(), null, null));
}
Also used : ConfigConverter(org.apache.servicecomb.config.common.ConfigConverter) RequestConfig(org.apache.http.client.config.RequestConfig) HttpTransport(org.apache.servicecomb.http.client.common.HttpTransport) KieConfiguration(org.apache.servicecomb.config.kie.client.model.KieConfiguration) KieAddressManager(org.apache.servicecomb.config.kie.client.model.KieAddressManager) KieConfigManager(org.apache.servicecomb.config.kie.client.KieConfigManager) KieClient(org.apache.servicecomb.config.kie.client.KieClient)

Example 2 with KieConfiguration

use of org.apache.servicecomb.config.kie.client.model.KieConfiguration in project incubator-servicecomb-java-chassis by apache.

the class KieConfigurationSourceImpl method init.

@Override
public void init(Configuration localConfiguration) {
    configConverter = new ConfigConverter(KieConfig.INSTANCE.getFileSources());
    KieAddressManager kieAddressManager = configKieAddressManager();
    RequestConfig.Builder requestBuilder = HttpTransportFactory.defaultRequestConfig();
    if (KieConfig.INSTANCE.enableLongPolling() && KieConfig.INSTANCE.getPollingWaitTime() >= 0) {
        requestBuilder.setConnectionRequestTimeout(KieConfig.INSTANCE.getPollingWaitTime() * 2 * 1000);
        requestBuilder.setSocketTimeout(KieConfig.INSTANCE.getPollingWaitTime() * 2 * 1000);
    }
    HttpTransport httpTransport = createHttpTransport(kieAddressManager, requestBuilder.build(), localConfiguration);
    KieConfiguration kieConfiguration = createKieConfiguration();
    KieClient kieClient = new KieClient(kieAddressManager, httpTransport, kieConfiguration);
    EventManager.register(this);
    kieConfigManager = new KieConfigManager(kieClient, EventManager.getEventBus(), kieConfiguration, configConverter);
    kieConfigManager.firstPull();
    kieConfigManager.startConfigKieManager();
    updateConfiguration(WatchedUpdateResult.createIncremental(configConverter.getCurrentData(), null, null));
}
Also used : ConfigConverter(org.apache.servicecomb.config.common.ConfigConverter) RequestConfig(org.apache.http.client.config.RequestConfig) HttpTransport(org.apache.servicecomb.http.client.common.HttpTransport) KieConfiguration(org.apache.servicecomb.config.kie.client.model.KieConfiguration) KieAddressManager(org.apache.servicecomb.config.kie.client.model.KieAddressManager) KieConfigManager(org.apache.servicecomb.config.kie.client.KieConfigManager) KieClient(org.apache.servicecomb.config.kie.client.KieClient)

Aggregations

RequestConfig (org.apache.http.client.config.RequestConfig)2 ConfigConverter (org.apache.servicecomb.config.common.ConfigConverter)2 KieClient (org.apache.servicecomb.config.kie.client.KieClient)2 KieConfigManager (org.apache.servicecomb.config.kie.client.KieConfigManager)2 KieAddressManager (org.apache.servicecomb.config.kie.client.model.KieAddressManager)2 KieConfiguration (org.apache.servicecomb.config.kie.client.model.KieConfiguration)2 HttpTransport (org.apache.servicecomb.http.client.common.HttpTransport)2