public Task <Unit> Handle(ResolveOutageCommand request, CancellationToken cancellationToken) { return(Task.Run <Unit>(() => { _logger.LogInfo($"[OutageLifecycleCommandHandler::IsolateOutageCommand] Sending isolate outage command for outage: {request.OutageId}"); using (OutageLifecycleUICommandingProxy commandingProxy = _proxyFactory.CreateProxy <OutageLifecycleUICommandingProxy, IOutageLifecycleUICommandingContract>( EndpointNames.OutageLifecycleUICommandingEndpoint) ) { try { commandingProxy.ResolveOutage(request.OutageId); } catch (Exception ex) { _logger.LogError("[OutageLifecycleCommandHandler::IsolateOutageCommand] OutageLifecycleCommandHandler failed on IsolateOutage handler.", ex); throw; } } return Task.FromResult(new Unit()); }, cancellationToken)); }
public async Task <Unit> Handle(ResolveOutageCommand request, CancellationToken cancellationToken) { Logger.LogInformation($"[OutageLifecycleCommandHandler::IsolateOutageCommand] Sending isolate outage command for outage: {request.OutageId}"); try { var resolveOutageClient = OutageResolutionClient.CreateClient(); await resolveOutageClient.ResolveOutage(request.OutageId); } catch (Exception ex) { Logger.LogError("[OutageLifecycleCommandHandler::IsolateOutageCommand] OutageLifecycleCommandHandler failed on IsolateOutage handler.", ex); throw; } return(new Unit()); }