Exemple #1
0
        private async Task <DestinationConfig> GetDestinationConfigAsync(string destinationId, CancellationToken cancellationToken)
        {
            var configSetName      = _configSetNameProvider.GetConfigSetName();
            var destinationsConfig = await _destinationsConfigProvider.GetDestinationsConfigAsync(configSetName, cancellationToken);

            var destinationConfig = destinationsConfig.Where(x => x.DestinationId.Equals(destinationId, StringComparison.CurrentCultureIgnoreCase)).SingleOrDefault();

            if (destinationConfig == null)
            {
                throw new Exception($"Destination with id '{destinationId}' not found");
            }

            return(destinationConfig);
        }
Exemple #2
0
        public async Task <IEnumerable <DestinationConfig> > GetDestinationsConfigAsync(string configSetName, CancellationToken cancellationToken)
        {
            var displayConfigSetName = configSetName ?? "<default>";

            try
            {
                _logger.LogTrace("Started getting destinations config '{configSetName}'", displayConfigSetName);

                var result = await _destinationsConfigProvider.GetDestinationsConfigAsync(configSetName, cancellationToken);

                _logger.LogTrace("Finished getting destinations config '{configSetName}'", displayConfigSetName);

                return(result);
            }
            catch (Exception e)
            {
                _logger.LogCritical("Error getting destinations config '{configSetName}': {errorMessage}", displayConfigSetName, e.GetAggregateMessages());
                throw;
            }
        }