public async Task <ActionResult <IntegrationInfoResponse> > GetInfo()
        {
            var blockchainInfoTask   = _blockchainInfoProvider.GetInfoAsync();
            var dependenciesInfoTask = _dependenciesInfoProvider.GetInfoAsync();

            var blockchainInfo = await blockchainInfoTask;

            if (blockchainInfo == null)
            {
                throw new InvalidOperationException("Not null blockchain info expected");
            }

            var dependenciesInfo = await dependenciesInfoTask;

            if (dependenciesInfo == null)
            {
                throw new InvalidOperationException("Not null dependencies info expected");
            }

            var response = new IntegrationInfoResponse
                           (
                blockchainInfo,
                dependenciesInfo
                           );

            return(Ok(response));
        }
Exemple #2
0
        public async Task StartAsync()
        {
            _log.Info("Settings", _settingsRenderer.RenderSettings());

            _log.Info("Starting health monitor...");

            _healthMonitor.Start();

            _log.Info("Getting integration health...");

            var disease = await _healthProvider.GetDiseaseAsync();

            if (disease == null)
            {
                _log.Info("Integration is healthy");
            }
            else
            {
                _log.Warning($"Integration is unhealthy: {disease}");
            }

            _log.Info("Getting blockchain info...");

            var blockchainInfo = await _blockchainInfoProvider.GetInfoAsync();

            _log.Info("Blockchain info", blockchainInfo);

            _log.Info("Getting dependencies info...");

            var dependenciesInfo = await _dependenciesInfoProvider.GetInfoAsync();

            _log.Info("Dependencies info", dependenciesInfo);
        }
        public Task <IReadOnlyDictionary <DependencyName, DependencyInfo> > GetInfoAsync()
        {
            const string key = nameof(CachedDependenciesInfoProviderDecorator);

            return(_cache.GetOrAddAsync(key, _cacheExpirationPeriod, () => _inner.GetInfoAsync()));
        }