Пример #1
0
        /// <summary>
        /// Moves the specified message to the poison queue.
        /// </summary>
        /// <param name="message">The poison message</param>
        /// <param name="poisonQueue">The poison queue to copy the message to</param>
        /// <param name="cancellationToken">The <see cref="CancellationToken"/> to use</param>
        /// <returns></returns>
        protected virtual async Task CopyMessageToPoisonQueueAsync(CloudQueueMessage message, CloudQueue poisonQueue, CancellationToken cancellationToken)
        {
            _trace.Warning(string.Format(CultureInfo.InvariantCulture, "Message has reached MaxDequeueCount of {0}. Moving message to queue '{1}'.", MaxDequeueCount, poisonQueue.Name), TraceSource.Execution);

            await AddMessageAndCreateIfNotExistsAsync(poisonQueue, message, cancellationToken);

            var eventArgs = new PoisonMessageEventArgs(message, poisonQueue);

            OnMessageAddedToPoisonQueue(eventArgs);
        }
        /// <summary>
        /// Moves the specified message to the poison queue.
        /// </summary>
        /// <param name="message">The poison message.</param>
        /// <param name="poisonQueue">The poison queue to copy the message to.</param>
        /// <param name="cancellationToken">The <see cref="CancellationToken"/> to use.</param>
        /// <returns></returns>
        protected virtual async Task CopyMessageToPoisonQueueAsync(QueueMessage message, QueueClient poisonQueue, CancellationToken cancellationToken)
        {
            string msg = string.Format(CultureInfo.InvariantCulture, "Message has reached MaxDequeueCount of {0}. Moving message to queue '{1}'.", QueuesOptions.MaxDequeueCount, poisonQueue.Name);

            _logger?.LogWarning(msg);

            await poisonQueue.AddMessageAndCreateIfNotExistsAsync(message.MessageText, cancellationToken).ConfigureAwait(false);

            var eventArgs = new PoisonMessageEventArgs(message, poisonQueue);

            OnMessageAddedToPoisonQueue(eventArgs);
        }
Пример #3
0
 /// <summary>
 /// Called to raise the MessageAddedToPoisonQueue event
 /// </summary>
 /// <param name="e">The event arguments</param>
 protected internal virtual void OnMessageAddedToPoisonQueue(PoisonMessageEventArgs e)
 {
     MessageAddedToPoisonQueue?.Invoke(this, e);
 }
 /// <summary>
 /// Called to raise the MessageAddedToPoisonQueue event.
 /// </summary>
 /// <param name="e">The event arguments.</param>
 protected internal virtual Task OnMessageAddedToPoisonQueueAsync(PoisonMessageEventArgs e)
 {
     return(MessageAddedToPoisonQueueAsync?.Invoke(this, e) ?? Task.CompletedTask);
 }