Bus Processor Class
The ServiceBusProcessor provides an abstraction around a set of ServiceBusReceiver that allows using an event based model for processing received ServiceBusReceivedMessage. It is constructed by calling CreateProcessor(String, ServiceBusProcessorOptions). The message handler is specified with the ProcessMessageAsync property. The error handler is specified with the ProcessErrorAsync property. To start processing after the handlers have been specified, call StartProcessingAsync(CancellationToken).
public class ServiceBusProcessor : IAsyncDisposable
type ServiceBusProcessor = class interface IAsyncDisposable
Public Class ServiceBusProcessor Implements IAsyncDisposable
Initializes a new instance of the ServiceBusProcessor class for mocking.
Gets a value that indicates whether the processor should automatically complete messages after the message handler has completed processing. If the message handler triggers an exception, the message will not be automatically completed.
Gets the path of the Service Bus entity that the processor is connected to, specific to the Service Bus namespace that contains it.
Gets the fully qualified Service Bus namespace that the receiver is associated with. This is likely
to be similar to
Indicates whether or not this ServiceBusProcessor has been closed.
Gets whether or not this processor is currently processing messages.
Gets the maximum duration within which the lock will be renewed automatically. This value should be greater than the longest message lock duration; for example, the LockDuration Property.
Gets the maximum number of concurrent calls to the ProcessMessageAsync message handler the processor should initiate.
Gets the number of messages that will be eagerly requested from Queues or Subscriptions during processing. This is intended to help maximize throughput by allowing the processor to receive from a local cache rather than waiting on a service request.
Gets the ReceiveMode used to specify how messages are received. Defaults to PeekLock mode.
Performs the task needed to clean up resources used by the ServiceBusProcessor.
Invokes the error event handler when an error has occured during processing. This method can be overriden to raise an event manually for testing purposes.
Invokes the process message event handler after a message has been received. This method can be overriden to raise an event manually for testing purposes.
Signals the processor to begin processing messages. Should this method be called while the processor is already running, an InvalidOperationException is thrown.
Signals the processor to stop processing messaging. Should this method be called while the processor is not running, no action is taken. This method will not close the underlying receivers, but will cause the receivers to stop receiving. To close the underlying receivers, CloseAsync(CancellationToken) should be called.
The handler responsible for processing unhandled exceptions thrown while this processor is running. Implementation is mandatory.
The handler responsible for processing messages received from the Queue or Subscription. Implementation is mandatory.