Exemple #1
0
        public void AbandonAcknowledgment(bool ignoreError = true)
        {
            try
            {
                #region Abandoning Acknowledgment
                if (IsAcknowledgmentConfigured)
                {
                    queueClient.Abandon(lockToken);
                }
                else
                {
                    throw MessageQueueCommonItems.PrepareAndLogQueueException(
                              errorCode: QueueErrorCode.AcknowledgmentIsNotConfiguredForQueue,
                              message: ErrorMessages.AcknowledgmentIsNotConfiguredForQueue,
                              innerException: null,
                              queueContext: CommonItems.ServiceBusName,
                              queueName: queueName,
                              logger: logger);
                }
                #endregion
            }
            catch (QueueException)
            {
                if (ignoreError == false)
                {
                    throw;
                }
            }
            catch (Exception ex)
            {
                var queueException = MessageQueueCommonItems.PrepareAndLogQueueException(
                    errorCode: QueueErrorCode.FailedToAbandonMessageAcknowledgment,
                    message: ErrorMessages.FailedToAbandonMessageAcknowledgment,
                    innerException: ex,
                    queueContext: CommonItems.ServiceBusName,
                    queueName: queueName,
                    logger: logger);

                if (ignoreError == false)
                {
                    throw queueException;
                }
            }
        }
 public void Abandon(string id)
 {
     Interlocked.Increment(ref _abandonedCount);
     _queueClient.Abandon(new Guid(id));
 }