コード例 #1
0
        public async Task HandleEventAsync(UpdateFileConfigurationEventEventData eventData)
        {
            Name = eventData.Name;
            if (eventData.Name == _option.GatewayName)
            {
                var config = await _abpFileConfigurationRepository.GetFileConfiguration(eventData.Name);

                await _fileConfigurationRepository.Set(config);
            }
        }
コード例 #2
0
        public async Task HandleEventAsync(UpdateFileConfigurationEventEventData eventData)
        {
            Name = eventData.Name;
            if (eventData.Name == _option.GatewayName)
            {
                _logger.LogInformation($"gateway name: {eventData.Name} reload sucess.");
                var fileConfiguration = await _abpFileConfigurationRepository.GetFileConfiguration(eventData.Name);

                var config = await _internalConfigCreator.Create(fileConfiguration);

                if (!config.IsError)
                {
                    _internalConfigRepo.AddOrReplace(config.Data);
                }

                await _fileConfigurationRepository.Set(fileConfiguration);
            }
        }
コード例 #3
0
        public async Task <Response <FileConfiguration> > Get()
        {
            var config = _cache.Get(_option.CachePrefix + "FileConfiguration", "");

            if (config != null)
            {
                return(new OkResponse <FileConfiguration>(config));
            }
            var file = await _abpFileConfigurationRepository.GetFileConfiguration(_option.GatewayName);

            if (file.Routes == null || file.Routes.Count == 0)
            {
                return(new OkResponse <FileConfiguration>(null));
            }
            _logger.LogDebug(JsonConvert.SerializeObject(file));

            return(new OkResponse <FileConfiguration>(file));
        }