private async ValueTask <BlazorModuleManifest> GetModuleManifestCoreAsync(ModuleIdentifier module, CancellationToken cancellation) { var endPoint = await GetEndPointAsync(module, cancellation); var dispatchData = new DispatchDataDictionary <Query <BlazorModuleManifest> >(new Query <BlazorModuleManifest>()); var queryResult = await _messageDispatcher.DispatchAsync(dispatchData, publish : false, endPoint, cancellation); if (!queryResult.IsSuccessWithResult <BlazorModuleManifest>(out var manifest)) { throw new Exception($"Unable to load manifest for {module}."); // TODO } _manifestCache.TryAdd(module, manifest); _logger.LogTrace($"Successfully loaded manifest for module {module}."); return(manifest); }
private async ValueTask <BlazorModuleManifest?> GetModuleManifestCoreAsync(ModuleIdentifier module, CancellationToken cancellation) { var moduleProperties = await _modulePropertiesLookup.LookupAsync(module, cancellation); if (moduleProperties == null) { _logger?.LogError($"Unable to load manifest for {module}. The module properties could not be fetched."); return(null); } foreach (var endPoint in moduleProperties.EndPoints) { var dispatchData = new DispatchDataDictionary <Query <BlazorModuleManifest> >(new Query <BlazorModuleManifest>()); var queryResult = await _messageDispatcher.DispatchAsync(dispatchData, publish : false, endPoint, cancellation); if (!queryResult.IsSuccessWithResult <BlazorModuleManifest>(out var manifest)) { _logger?.LogWarning($"Unable to load manifest for {module} from end-point {endPoint}."); continue; } _cache.TryAdd(module, manifest); _logger?.LogDebug($"Successfully loaded manifest for module {module}."); return(manifest); } if (moduleProperties.EndPoints.Any()) { _logger?.LogError($"Unable to load manifest for {module}. No end-point matched."); } else { _logger?.LogError($"Unable to load manifest for {module}. No end-points available."); } return(null); }
private async Task <IDispatchResult> DispatchToEndPointAsync(EndPointAddress endPoint, ModuleHttpRequest moduleHttpRequest, CancellationToken cancellation) { return(await _dispatcher.DispatchAsync(new DispatchDataDictionary <ModuleHttpRequest>(moduleHttpRequest), publish : false, endPoint, cancellation)); }