private void ContinueOnTimeout(ReceptionContext <TMessage> receptionContext, DispatchContext <TMessage> dispatchContext) { if (!dispatchContext.OwnedCancellation.IsCancellationRequested) { lock (dispatchContext.Locker) { if (!dispatchContext.OwnedCancellation.IsCancellationRequested) { foreach (var timeout in _timeoutHandlers) { try { timeout(dispatchContext); } catch { } } dispatchContext.Dispose(); receptionContext.Timeout(); } } } }
private void ContinueOnSuccess(ReceptionContext <TMessage> receptionContext, DispatchContext <TMessage> dispatchContext) { if (!dispatchContext.OwnedCancellation.IsCancellationRequested) { lock (dispatchContext.Locker) { if (!dispatchContext.OwnedCancellation.IsCancellationRequested) { foreach (var complete in _completeHandlers) { try { complete(dispatchContext); } catch { } } dispatchContext.Dispose(); receptionContext.Success(); } } } }