public async Task <BaseOutput> SyncApiGatewayConfigurationToConsul([FromQuery] SyncApiGatewayConfigurationInput input) { var configInfo = _adminDbContext.Queryable <ApiGatewayConfigurationModel>().First(it => it.GatewayId == input.GatewayId); if (configInfo != null) { var data = GetGatewayData(input.GatewayId); await _serviceDiscovery.KeyValuePutAsync(configInfo.GatewayKey, Json.ToJson(data)); } return(new BaseOutput { }); }
/// <summary> /// 同步至Consul /// </summary> /// <param name="input"></param> /// <returns></returns> public async Task <BaseOutput> SyncApiGatewayConfigurationToConsul(SyncApiGatewayConfigurationInput input) { var configInfo = await _configDbRepository.GetFirstAsync(it => it.GatewayId == input.GatewayId); if (configInfo != null) { var data = await GetGatewayData(input.GatewayId); await _serviceDiscovery.KeyValuePutAsync(configInfo.GatewayKey, Json.ToJson(data)); } return(new BaseOutput { }); }
public async Task <BaseOutput> SyncApiGatewayConfigurationToRedis([FromQuery] SyncApiGatewayConfigurationInput input) { var configInfo = _adminDbContext.Queryable <ApiGatewayConfigurationModel>().First(it => it.GatewayId == input.GatewayId); if (configInfo != null) { var data = GetGatewayData(input.GatewayId); var redis = _cachingProviderFactory.GetCachingProvider("default_redis"); await redis.SetAsync($"ApiGateway:{configInfo.GatewayKey}", data, TimeSpan.MaxValue); } return(new BaseOutput { }); }
/// <summary> /// 同步至redis /// </summary> /// <param name="input"></param> /// <returns></returns> public async Task <BaseOutput> SyncApiGatewayConfigurationToRedis(SyncApiGatewayConfigurationInput input) { var configInfo = await _configDbRepository.GetFirstAsync(it => it.GatewayId == input.GatewayId); if (configInfo != null) { var redis = _redisClient.GetDatabase(_config.StringGet(SysConfig.RedisConnectionKey), 11); var data = await GetGatewayData(input.GatewayId); await redis.StringSetAsync($"ApiGateway:{configInfo.GatewayKey}", Json.ToJson(data)); } return(new BaseOutput { }); }
public async Task <BaseOutput> SyncApiGatewayConfigurationToConsul([FromQuery] SyncApiGatewayConfigurationInput input) { return(await _microserviceBusines.SyncApiGatewayConfigurationToConsul(input)); }