public virtual async Task <AggregateReRouteConfigDto> AddRouteConfigAsync(AggregateReRouteConfigCreateDto input)
        {
            var routeId        = long.Parse(input.RouteId);
            var aggregateRoute = await _aggregateReRouteRepository.GetByRouteIdAsync(routeId);

            aggregateRoute.RemoveReRouteConfig(input.ReRouteKey)
            .AddReRouteConfig(input.ReRouteKey, input.Parameter,
                              input.JsonPath);
            var aggregateRouteConfig = aggregateRoute.FindReRouteConfig(input.ReRouteKey);

            await _aggregateReRouteRepository.UpdateAsync(aggregateRoute);

            await DistributedEventBus.PublishAsync(new ApigatewayConfigChangeEventData(aggregateRoute.AppId, "AggregateRoute", "AddRouteConfig"));

            return(ObjectMapper.Map <AggregateReRouteConfig, AggregateReRouteConfigDto>(aggregateRouteConfig));
        }
Exemple #2
0
        public virtual async Task <AggregateReRouteConfigDto> AddRouteConfigAsync(AggregateReRouteConfigCreateDto aggregateReRouteConfigCreate)
        {
            var routeId        = long.Parse(aggregateReRouteConfigCreate.RouteId);
            var aggregateRoute = await _aggregateReRouteRepository.GetByRouteIdAsync(routeId);

            aggregateRoute.RemoveReRouteConfig(aggregateReRouteConfigCreate.ReRouteKey)
            .AddReRouteConfig(aggregateReRouteConfigCreate.ReRouteKey, aggregateReRouteConfigCreate.Parameter,
                              aggregateReRouteConfigCreate.JsonPath);
            var aggregateRouteConfig = aggregateRoute.FindReRouteConfig(aggregateReRouteConfigCreate.ReRouteKey);

            await _aggregateReRouteRepository.UpdateAsync(aggregateRoute);

            await _eventPublisher.PublishAsync(ApigatewayConfigChangeCommand.EventName,
                                               new ApigatewayConfigChangeCommand("AggregateRoute", "AddRouteConfig"));

            return(ObjectMapper.Map <AggregateReRouteConfig, AggregateReRouteConfigDto>(aggregateRouteConfig));
        }
Exemple #3
0
 public async Task <AggregateReRouteConfigDto> AddRouteConfigAsync(AggregateReRouteConfigCreateDto aggregateReRouteConfigCreate)
 {
     return(await AggregateReRouteAppService.AddRouteConfigAsync(aggregateReRouteConfigCreate));
 }