public Task<Continuation> Invoke(IncomingContext context) { return new Continuation { After = () => Task.Delay(10) }; }
public async Task<ExceptionDispatchInfo> InnerInvoke(IncomingContext context) { var continuations = new Stack<Continuation>(); ExceptionDispatchInfo exception = null; foreach (var element in executingElements) { var continuation = Continuation.Empty; try { continuation = await element.Invoke(context).ConfigureAwait(false); } catch (Exception e) { exception = ExceptionDispatchInfo.Capture(e); break; } finally { continuations.Push(continuation); } } foreach (var continuation in continuations) { if (exception == null) { try { await continuation.After().ConfigureAwait(false); } catch (Exception e) { exception = ExceptionDispatchInfo.Capture(e); } } else { try { if (continuation.Catch != null) { exception = await continuation.Catch(exception).ConfigureAwait(false); } } catch (Exception e) { exception = ExceptionDispatchInfo.Capture(e); } } await continuation.Finally().ConfigureAwait(false); } return exception; }
public Task <Continuation> Invoke(IncomingContext context) { return(new Continuation { Catch = async info => { info.SourceException.StackTrace.Output(); countdown.Signal(); return null; } }); }
public Task Invoke(IncomingContext context) { return InnerInvoke(context); }
public async Task<Continuation> Invoke(IncomingContext context) { await Task.Delay(10).ConfigureAwait(false); throw new InvalidOperationException(nameof(ThrowException)); }
public async Task<Continuation> Invoke(IncomingContext context) { await Task.Delay(10).ConfigureAwait(false); return Continuation.Empty; }
static Task Connector(ChainFactory factory, TransportMessage message) { var pipeline = factory.Create(); var context = new IncomingContext(message); return pipeline.Invoke(context); }
public Task<Continuation> Invoke(IncomingContext context) { return new Continuation { Catch = async info => { info.SourceException.StackTrace.Output(); countdown.Signal(); return null; } }; }
public async Task<Continuation> Invoke(IncomingContext context) { var scope = new TransactionScope(TransactionScopeAsyncFlowOption.Enabled); await Task.Delay(10).ConfigureAwait(false); return new Continuation { After = () => { scope.Complete(); return Task.CompletedTask; }, Finally = () => { scope.Dispose(); return Task.CompletedTask; } }; }
public Task<Continuation> Invoke(IncomingContext context) { return Continuation.Empty; }
public Task Invoke(IncomingContext context) { return(InnerInvoke(context)); }
public async Task <Continuation> Invoke(IncomingContext context) { await Task.Delay(10).ConfigureAwait(false); throw new InvalidOperationException(nameof(ThrowException)); }
public async Task <Continuation> Invoke(IncomingContext context) { await Task.Delay(10).ConfigureAwait(false); return(Continuation.Empty); }
public Task <Continuation> Invoke(IncomingContext context) { return(Continuation.Empty); }