Search in sources :

Example 6 with ConfigResponse

use of com.alibaba.nacos.client.config.filter.impl.ConfigResponse in project nacos by alibaba.

the class ClientWorker method refreshContentAndCheck.

private void refreshContentAndCheck(CacheData cacheData, boolean notify) {
    try {
        ConfigResponse response = getServerConfig(cacheData.dataId, cacheData.group, cacheData.tenant, 3000L, notify);
        cacheData.setContent(response.getContent());
        cacheData.setEncryptedDataKey(response.getEncryptedDataKey());
        if (null != response.getConfigType()) {
            cacheData.setType(response.getConfigType());
        }
        if (notify) {
            LOGGER.info("[{}] [data-received] dataId={}, group={}, tenant={}, md5={}, content={}, type={}", agent.getName(), cacheData.dataId, cacheData.group, cacheData.tenant, cacheData.getMd5(), ContentUtils.truncateContent(response.getContent()), response.getConfigType());
        }
        cacheData.checkListenerMd5();
    } catch (Exception e) {
        LOGGER.error("refresh content and check md5 fail ,dataId={},group={},tenant={} ", cacheData.dataId, cacheData.group, cacheData.tenant, e);
    }
}
Also used : ConfigResponse(com.alibaba.nacos.client.config.filter.impl.ConfigResponse) NacosException(com.alibaba.nacos.api.exception.NacosException)

Aggregations

ConfigResponse (com.alibaba.nacos.client.config.filter.impl.ConfigResponse)6 NacosException (com.alibaba.nacos.api.exception.NacosException)3 Listener (com.alibaba.nacos.api.config.listener.Listener)2 Test (org.junit.Test)2 ConfigChangeEvent (com.alibaba.nacos.api.config.ConfigChangeEvent)1 AbstractSharedListener (com.alibaba.nacos.api.config.listener.AbstractSharedListener)1 AbstractConfigChangeListener (com.alibaba.nacos.client.config.listener.impl.AbstractConfigChangeListener)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 RejectedExecutionException (java.util.concurrent.RejectedExecutionException)1