async ValueTask IConnector <TInput> .ProcessAsync(TInput input, ChainContext context) { TOutput result; var startTickCount = Environment.TickCount64; try { context.EventBroker.Publish(new ConnectorStartingEvent(context, this)); context.CancellationToken.ThrowIfCancellationRequested(); result = await ProcessAsync(input, context); } catch (Exception exception) { context.SetResult(ExecutionResult.Faulted, exception); return; } finally { var duration = TimeSpan.FromMilliseconds(Environment.TickCount64 - startTickCount); context.EventBroker.Publish(new ConnectorStoppedEvent(context, this, duration)); } if (context.Result == ExecutionResult.Unknown) { await _nextConnector.ProcessAsync(result, context); } }
protected override ValueTask <TInput> ProcessAsync(TInput input, ChainContext context) { context.SetResult(ExecutionResult.Completed, null, _reason); return(new ValueTask <TInput>(input)); }