Show / Hide Table of Contents

Class MessageProcessor

This class defines a strategy used for processing Service Bus messages.

Inheritance
System.Object
MessageProcessor
Namespace: System.Dynamic.ExpandoObject
Assembly: Microsoft.Azure.WebJobs.Extensions.ServiceBus.dll
Syntax
public class MessageProcessor

Constructors

MessageProcessor(ServiceBusProcessor)

Initializes a new instance of MessageProcessor.

Declaration
protected internal MessageProcessor (Azure.Messaging.ServiceBus.ServiceBusProcessor processor);
Parameters
Azure.Messaging.ServiceBus.ServiceBusProcessor processor

The Azure.Messaging.ServiceBus.ServiceBusProcessor to use for processing messages from Service Bus.

Properties

Processor

Gets or sets the Azure.Messaging.ServiceBus.ServiceBusProcessor that will be used by the Processor.

Declaration
protected internal Azure.Messaging.ServiceBus.ServiceBusProcessor Processor { get; }
Property Value
Azure.Messaging.ServiceBus.ServiceBusProcessor

Methods

BeginProcessingMessageAsync(ServiceBusMessageActions, ServiceBusReceivedMessage, 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
protected internal virtual System.Threading.Tasks.Task<bool> BeginProcessingMessageAsync (Microsoft.Azure.WebJobs.ServiceBus.ServiceBusMessageActions actions, Azure.Messaging.ServiceBus.ServiceBusReceivedMessage message, System.Threading.CancellationToken cancellationToken);
Parameters
ServiceBusMessageActions actions

The set of actions that can be performed on a Azure.Messaging.ServiceBus.ServiceBusReceivedMessage.

Azure.Messaging.ServiceBus.ServiceBusReceivedMessage message

The Azure.Messaging.ServiceBus.ServiceBusReceivedMessage to process.

System.Threading.CancellationToken cancellationToken

A cancellation token that will be cancelled when the processor is shutting down.

Returns
System.Threading.Tasks.Task<System.Boolean>

A System.Threading.Tasks.Task that returns true if the message processing should continue, false otherwise.

CompleteProcessingMessageAsync(ServiceBusMessageActions, ServiceBusReceivedMessage, FunctionResult, CancellationToken)

This method completes processing of the specified message, after the job function has been invoked.

Declaration
protected internal virtual System.Threading.Tasks.Task CompleteProcessingMessageAsync (Microsoft.Azure.WebJobs.ServiceBus.ServiceBusMessageActions actions, Azure.Messaging.ServiceBus.ServiceBusReceivedMessage message, Microsoft.Azure.WebJobs.Host.Executors.FunctionResult result, System.Threading.CancellationToken cancellationToken);
Parameters
ServiceBusMessageActions actions

The set of actions that can be performed on a Azure.Messaging.ServiceBus.ServiceBusReceivedMessage.

Azure.Messaging.ServiceBus.ServiceBusReceivedMessage message

The Azure.Messaging.ServiceBus.ServiceBusReceivedMessage to process.

Microsoft.Azure.WebJobs.Host.Executors.FunctionResult result

The Microsoft.Azure.WebJobs.Host.Executors.FunctionResult from the job invocation.

System.Threading.CancellationToken cancellationToken

A cancellation token that will be cancelled when the processor is shutting down.

Returns
System.Threading.Tasks.Task

A System.Threading.Tasks.Task that will complete the message processing.

Remarks

The message is completed by the ServiceBus SDK based on how the Azure.Messaging.ServiceBus.ServiceBusProcessorOptions.AutoCompleteMessages option is configured. E.g. if Azure.Messaging.ServiceBus.ServiceBusProcessorOptions.AutoCompleteMessages is false, it is up to the job function to complete the message.

Back to top Azure SDK for .NET