private void ReleaseMessage(BrokeredMessage msg, MessageReleaseAction releaseAction, long processingElapsedMilliseconds, long schedulingElapsedMilliseconds, Stopwatch roundtripStopwatch) { switch (releaseAction.Kind) { case MessageReleaseActionKind.Complete: msg.SafeCompleteAsync( this.subscription, success => { msg.Dispose(); this.instrumentation.MessageCompleted(success); if (success) { this.dynamicThrottling.NotifyWorkCompleted(); } else { this.dynamicThrottling.NotifyWorkCompletedWithError(); } }, processingElapsedMilliseconds, schedulingElapsedMilliseconds, roundtripStopwatch); break; case MessageReleaseActionKind.Abandon: msg.SafeAbandonAsync( this.subscription, success => { msg.Dispose(); this.instrumentation.MessageCompleted(false); this.dynamicThrottling.NotifyWorkCompletedWithError(); }, processingElapsedMilliseconds, schedulingElapsedMilliseconds, roundtripStopwatch); break; case MessageReleaseActionKind.DeadLetter: msg.SafeDeadLetterAsync( this.subscription, releaseAction.DeadLetterReason, releaseAction.DeadLetterDescription, success => { msg.Dispose(); this.instrumentation.MessageCompleted(false); this.dynamicThrottling.NotifyWorkCompletedWithError(); }, processingElapsedMilliseconds, schedulingElapsedMilliseconds, roundtripStopwatch); break; default: break; } }
private void ReleaseMessage(BrokeredMessage msg, MessageReleaseAction releaseAction, Action completeReceive, Action onReleaseError, CountdownEvent countdown, long processingElapsedMilliseconds, long schedulingElapsedMilliseconds, Stopwatch roundtripStopwatch) { switch (releaseAction.Kind) { case MessageReleaseActionKind.Complete: msg.SafeCompleteAsync( this.subscription, operationSucceeded => { msg.Dispose(); this.OnMessageCompleted(operationSucceeded, countdown); if (operationSucceeded) { completeReceive(); } else { onReleaseError(); } }, processingElapsedMilliseconds, schedulingElapsedMilliseconds, roundtripStopwatch); break; case MessageReleaseActionKind.Abandon: this.dynamicThrottling.Penalize(); msg.SafeAbandonAsync( this.subscription, operationSucceeded => { msg.Dispose(); this.OnMessageCompleted(false, countdown); onReleaseError(); }, processingElapsedMilliseconds, schedulingElapsedMilliseconds, roundtripStopwatch); break; case MessageReleaseActionKind.DeadLetter: this.dynamicThrottling.Penalize(); msg.SafeDeadLetterAsync( this.subscription, releaseAction.DeadLetterReason, releaseAction.DeadLetterDescription, operationSucceeded => { msg.Dispose(); this.OnMessageCompleted(false, countdown); if (operationSucceeded) { completeReceive(); } else { onReleaseError(); } }, processingElapsedMilliseconds, schedulingElapsedMilliseconds, roundtripStopwatch); break; default: break; } }