Class QueueProcessor
This class defines a strategy used for processing queue messages.
Inheritance
Namespace: System.Dynamic.ExpandoObject
Assembly: Microsoft.Azure.WebJobs.Extensions.Storage.Queues.dll
Syntax
public class QueueProcessor
Remarks
Custom QueueProcessor implementations can be registered by implementing a custom IQueueProcessorFactory.
Constructors
QueueProcessor(QueueProcessorOptions)
Constructs a new instance.
Declaration
protected internal QueueProcessor (Microsoft.Azure.WebJobs.Host.Queues.QueueProcessorOptions queueProcessorOptions);
Parameters
|
QueueProcessorOptions
queueProcessorOptions
The options. |
Methods
BeginProcessingMessageAsync(QueueMessage, CancellationToken)
This method is called when there is a new message to process, before the job function is invoked. This allows any preprocessing to take place on the message before processing begins.
Declaration
[System.Diagnostics.DebuggerStepThrough]
protected internal virtual System.Threading.Tasks.Task<bool> BeginProcessingMessageAsync (Azure.Storage.Queues.Models.QueueMessage message, System.Threading.CancellationToken cancellationToken);
Parameters
|
Azure.Storage.Queues.Models.QueueMessage
message
The message to process. |
|
System.Threading.CancellationToken
cancellationToken
The System.Threading.CancellationToken to use |
Returns
|
System.Threading.Tasks.Task<System.Boolean>
True if the message processing should continue, false otherwise. |
CompleteProcessingMessageAsync(QueueMessage, FunctionResult, CancellationToken)
This method completes processing of the specified message, after the job function has been invoked.
Declaration
[System.Diagnostics.DebuggerStepThrough]
protected internal virtual System.Threading.Tasks.Task CompleteProcessingMessageAsync (Azure.Storage.Queues.Models.QueueMessage message, Microsoft.Azure.WebJobs.Host.Executors.FunctionResult result, System.Threading.CancellationToken cancellationToken);
Parameters
|
Azure.Storage.Queues.Models.QueueMessage
message
The message to complete processing for. |
|
Microsoft.Azure.WebJobs.Host.Executors.FunctionResult
result
The Microsoft.Azure.WebJobs.Host.Executors.FunctionResult from the job invocation. |
|
System.Threading.CancellationToken
cancellationToken
The System.Threading.CancellationToken to use. |
Returns
|
System.Threading.Tasks.Task
|
Remarks
If the message was processed successfully, the message should be deleted. If message processing failed, the
message should be release back to the queue, or if the maximum dequeue count has been exceeded, the message
should be moved to the poison queue (if poison queue handling is configured for the queue).
CopyMessageToPoisonQueueAsync(QueueMessage, QueueClient, CancellationToken)
Moves the specified message to the poison queue.
Declaration
[System.Diagnostics.DebuggerStepThrough]
protected virtual System.Threading.Tasks.Task CopyMessageToPoisonQueueAsync (Azure.Storage.Queues.Models.QueueMessage message, Azure.Storage.Queues.QueueClient poisonQueue, System.Threading.CancellationToken cancellationToken);
Parameters
|
Azure.Storage.Queues.Models.QueueMessage
message
The poison message. |
|
Azure.Storage.Queues.QueueClient
poisonQueue
The poison queue to copy the message to. |
|
System.Threading.CancellationToken
cancellationToken
The System.Threading.CancellationToken to use. |
Returns
|
System.Threading.Tasks.Task
|
DeleteMessageAsync(QueueMessage, CancellationToken)
Delete the specified message.
Declaration
[System.Diagnostics.DebuggerStepThrough]
protected virtual System.Threading.Tasks.Task DeleteMessageAsync (Azure.Storage.Queues.Models.QueueMessage message, System.Threading.CancellationToken cancellationToken);
Parameters
|
Azure.Storage.Queues.Models.QueueMessage
message
The message to delete. |
|
System.Threading.CancellationToken
cancellationToken
The System.Threading.CancellationToken to use. |
Returns
|
System.Threading.Tasks.Task
|
OnMessageAddedToPoisonQueueAsync(PoisonMessageEventArgs)
Called to raise the MessageAddedToPoisonQueue event.
Declaration
protected internal virtual System.Threading.Tasks.Task OnMessageAddedToPoisonQueueAsync (Microsoft.Azure.WebJobs.Host.Queues.PoisonMessageEventArgs e);
Parameters
|
PoisonMessageEventArgs
e
The event arguments. |
Returns
|
System.Threading.Tasks.Task
|
ReleaseMessageAsync(QueueMessage, FunctionResult, TimeSpan, CancellationToken)
Release the specified failed message back to the queue.
Declaration
[System.Diagnostics.DebuggerStepThrough]
protected virtual System.Threading.Tasks.Task ReleaseMessageAsync (Azure.Storage.Queues.Models.QueueMessage message, Microsoft.Azure.WebJobs.Host.Executors.FunctionResult result, TimeSpan visibilityTimeout, System.Threading.CancellationToken cancellationToken);
Parameters
|
Azure.Storage.Queues.Models.QueueMessage
message
The message to release |
|
Microsoft.Azure.WebJobs.Host.Executors.FunctionResult
result
The Microsoft.Azure.WebJobs.Host.Executors.FunctionResult from the job invocation. |
|
System.TimeSpan
visibilityTimeout
The visibility timeout to set for the message. |
|
System.Threading.CancellationToken
cancellationToken
The System.Threading.CancellationToken to use. |
Returns
|
System.Threading.Tasks.Task
|
Events
MessageAddedToPoisonQueueAsync
Event raised when a message is added to the poison queue.
Declaration
public event Func<Microsoft.Azure.WebJobs.Host.Queues.QueueProcessor,Microsoft.Azure.WebJobs.Host.Queues.PoisonMessageEventArgs,System.Threading.Tasks.Task> MessageAddedToPoisonQueueAsync;