示例#1
0
        private void SafeNotifyListener(string dataId, string group, string content, string type,
                                        string md5, string encryptedDataKey, ManagerListenerWrap wrap)
        {
            var listener = wrap.Listener;

            ConfigResponse cr = new ConfigResponse();

            cr.SetDataId(dataId);
            cr.SetGroup(group);
            cr.SetContent(content);
            cr.SetEncryptedDataKey(encryptedDataKey);
            ConfigFilterChainManager.DoFilter(null, cr);

            // after filter, such as decrypted value
            string contentTmp = cr.GetContent();

            wrap.LastContent = content;
            wrap.LastCallMd5 = md5;

            // should pass the value after filter
            listener.ReceiveConfigInfo(contentTmp);
        }
示例#2
0
        public CacheData(ConfigFilterChainManager configFilterChainManager, LocalConfigInfoProcessor localConfigInfoProcessor, string name, string dataId, string group, string tenant)
        {
            if (string.IsNullOrEmpty(dataId))
            {
                throw new ArgumentNullException(nameof(dataId));
            }
            if (string.IsNullOrEmpty(group))
            {
                throw new ArgumentNullException(nameof(group));
            }

            _name = name;
            _configFilterChainManager = configFilterChainManager;
            _localConfigInfoProcessor = localConfigInfoProcessor;
            DataId         = dataId;
            Group          = group;
            Tenant         = tenant;
            _listeners     = new ConcurrentList <ManagerListenerWrap>();
            IsInitializing = true;
            Content        = LoadCacheContentFromDiskLocal(name, dataId, group, tenant);
            MD5            = GetMD5String(Content);
        }
示例#3
0
 public CacheDataTest()
 {
     _localConfigInfoProcessor = new LocalConfigInfoProcessor(AppDomain.CurrentDomain.BaseDirectory);
     _configFilterChainManager = new ConfigFilterChainManager();
 }