/// <summary>
 /// Constructs a new instance.
 /// </summary>
 /// <param name="message">The poison message</param>
 /// <param name="poisonQueue">The poison queue</param>
 public PoisonMessageEventArgs(QueueMessage message, QueueClient poisonQueue)
 {
     Message     = message;
     PoisonQueue = poisonQueue;
 }
Esempio n. 2
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(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.Body, cancellationToken).ConfigureAwait(false);

            var eventArgs = new PoisonMessageEventArgs(message, poisonQueue);

            OnMessageAddedToPoisonQueue(eventArgs);
        }
 /// <summary>
 /// Constructs a new instance.
 /// </summary>
 /// <param name="queue">The queue the <see cref="QueueProcessor"/> will operate on.</param>
 /// <param name="loggerFactory">The <see cref="ILoggerFactory"/> to create an <see cref="ILogger"/> from.</param>
 /// <param name="options">The queue configuration.</param>
 /// <param name="poisonQueue">The queue to move messages to when unable to process a message after the maximum dequeue count has been exceeded. May be null.</param>
 internal QueueProcessorOptions(QueueClient queue, ILoggerFactory loggerFactory, QueuesOptions options, QueueClient poisonQueue = null)
 {
     Queue       = queue ?? throw new ArgumentNullException(nameof(queue));
     PoisonQueue = poisonQueue;
     Logger      = loggerFactory?.CreateLogger <QueueProcessor>();
     Options     = options.Clone();
 }
Esempio n. 4
0
 /// <summary>
 /// Constructs a new instance.
 /// </summary>
 /// <param name="queue">The queue the <see cref="QueueProcessor"/> will operate on.</param>
 /// <param name="loggerFactory">The <see cref="ILoggerFactory"/> to create an <see cref="ILogger"/> from.</param>
 /// <param name="options">The queue configuration.</param>
 /// <param name="poisonQueue">The queue to move messages to when unable to process a message after the maximum dequeue count has been exceeded. May be null.</param>
 internal QueueProcessorOptions(QueueClient queue, ILoggerFactory loggerFactory, QueuesOptions options, QueueClient poisonQueue = null)
 {
     Queue       = queue ?? throw new ArgumentNullException(nameof(queue));
     PoisonQueue = poisonQueue;
     Logger      = loggerFactory?.CreateLogger(LogCategories.CreateTriggerCategory("Queue"));
     Options     = options;
 }
 /// <summary>
 /// Constructs a new instance.
 /// </summary>
 /// <param name="queue">TODO.</param>
 /// <param name="loggerFactory">The <see cref="ILoggerFactory"/> to create an <see cref="ILogger"/> from.</param>
 /// <param name="options">The queue configuration.</param>
 /// <param name="poisonQueue">The queue to move messages to when unable to process a message after the maximum dequeue count has been exceeded. May be null.</param>
 // TODO (kasobol-msft) this was internal before check this.
 public QueueProcessorFactoryContext(QueueClient queue, ILoggerFactory loggerFactory, QueuesOptions options, QueueClient poisonQueue = null)
     : this(queue, loggerFactory, poisonQueue)
 {
     BatchSize          = options.BatchSize;
     MaxDequeueCount    = options.MaxDequeueCount;
     NewBatchThreshold  = options.NewBatchThreshold;
     VisibilityTimeout  = options.VisibilityTimeout;
     MaxPollingInterval = options.MaxPollingInterval;
 }
 /// <summary>
 /// Constructs a new instance.
 /// </summary>
 /// <param name="queue">TODO.</param>
 /// <param name="loggerFactory">The <see cref="ILoggerFactory"/> to create an <see cref="ILogger"/> from.</param>
 /// <param name="poisonQueue">The queue to move messages to when unable to process a message after the maximum dequeue count has been exceeded. May be null.</param>
 public QueueProcessorFactoryContext(QueueClient queue, ILoggerFactory loggerFactory, QueueClient poisonQueue = null)
 {
     Queue       = queue ?? throw new ArgumentNullException(nameof(queue));
     PoisonQueue = poisonQueue;
     Logger      = loggerFactory?.CreateLogger(LogCategories.CreateTriggerCategory("Queue"));
 }