Search in sources :

Example 1 with NotifyCenter

use of com.alibaba.nacos.common.notify.NotifyCenter in project nacos by alibaba.

the class DistributedDatabaseOperateImpl method handleExtendInfo.

private void handleExtendInfo(Map<String, String> extendInfo) {
    if (extendInfo.containsKey(Constants.EXTEND_INFO_CONFIG_DUMP_EVENT)) {
        String jsonVal = extendInfo.get(Constants.EXTEND_INFO_CONFIG_DUMP_EVENT);
        if (StringUtils.isNotBlank(jsonVal)) {
            NotifyCenter.publishEvent(JacksonUtils.toObj(jsonVal, ConfigDumpEvent.class));
        }
        return;
    }
    if (extendInfo.containsKey(Constants.EXTEND_INFOS_CONFIG_DUMP_EVENT)) {
        String jsonVal = extendInfo.get(Constants.EXTEND_INFO_CONFIG_DUMP_EVENT);
        if (StringUtils.isNotBlank(jsonVal)) {
            List<ConfigDumpEvent> list = JacksonUtils.toObj(jsonVal, new GenericType<List<ConfigDumpEvent>>() {
            }.getType());
            list.stream().filter(Objects::nonNull).forEach(NotifyCenter::publishEvent);
        }
    }
}
Also used : ConfigDumpEvent(com.alibaba.nacos.config.server.model.event.ConfigDumpEvent) GenericType(com.alibaba.nacos.core.utils.GenericType) NotifyCenter(com.alibaba.nacos.common.notify.NotifyCenter) ByteString(com.google.protobuf.ByteString)

Aggregations

NotifyCenter (com.alibaba.nacos.common.notify.NotifyCenter)1 ConfigDumpEvent (com.alibaba.nacos.config.server.model.event.ConfigDumpEvent)1 GenericType (com.alibaba.nacos.core.utils.GenericType)1 ByteString (com.google.protobuf.ByteString)1