MessageConsumer Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Base class implementation for consuming and processing messages.
public ref class MessageConsumer abstract
public abstract class MessageConsumer
type MessageConsumer = class
Public MustInherit Class MessageConsumer
- Inheritance
-
MessageConsumer
- Derived
Remarks
Implementation classes are recommended to override the ProcessingStepAsync(CancellationToken) method and execute the FetchAndProcessMessageAsync(CancellationToken) in parallel or in any other way using Task Parallel Library (TPL) / DataFlow or any other abstractions.
Constructors
MessageConsumer(IMessageSource, IReadOnlyList<IMessageMiddleware>, MessageDelegate, ILogger) |
Initializes a new instance of the MessageConsumer class. |
Properties
Logger |
Gets the logger. |
MessageSource |
Gets the underlying message source. |
PipelineDelegate |
Gets the message delegate composed from the pipeline of IMessageMiddleware implementations and a terminal MessageDelegate. |
Methods
ExecuteAsync(CancellationToken) |
Start processing the messages. |
FetchAndProcessMessageAsync(CancellationToken) |
Fetches a MessageContext via the FetchMessageAsync(CancellationToken) and processes it asynchronously via ProcessMessageAsync(MessageContext). |
FetchMessageAsync(CancellationToken) |
Fetches message from the message source. |
HandleMessageProcessingCompletionAsync(MessageContext) |
Handles the completion of the message processing. |
HandleMessageProcessingFailureAsync(MessageContext, Exception) |
Handles failures that occur during the message processing. |
ProcessingStepAsync(CancellationToken) |
Represents processing steps for message(s). |
ProcessMessageAsync(MessageContext) |
Processes a message asynchronously. |
ReleaseContext(MessageContext) |
Releases the message context. |
ShouldStopConsumer(MessageContext) |
Determines if the consumer should stop processing. |