Interface IMessageManager
Instances of IMessageManager manage the lifecycle of a message being processed.
public interface IMessageManager
Remarks
Responsibilities:
- Start the async work of processing messages and add the task to collection of active tasks
- Monitor the active processing message's task
- If a task completes with success status code delete message
- While the message tasks are working periodically inform the source the message is still being processed.
Properties
ActiveMessageCount
The number of active messages being processed.
int ActiveMessageCount { get; }
Property Value
Methods
ProcessMessageAsync(MessageEnvelope, SubscriberMapping, CancellationToken)
Start the async processing of a message.
Task ProcessMessageAsync(MessageEnvelope messageEnvelope, SubscriberMapping subscriberMapping, CancellationToken token = default)
Parameters
messageEnvelope
MessageEnvelopeThe message to start processing
subscriberMapping
SubscriberMappingThe mapping between the message's type and its handler
token
CancellationTokenOptional token to cancel the message processing
Returns
ProcessMessageGroupAsync(List<ConvertToEnvelopeResult>, string, CancellationToken)
Starts the async processing of messages within an ordered group. These messages are processed sequentially in the order in which they appear.
Task ProcessMessageGroupAsync(List<ConvertToEnvelopeResult> messageGroup, string groupId, CancellationToken token = default)
Parameters
messageGroup
List<ConvertToEnvelopeResult>The ordered list of messages that will be processed sequentially
groupId
stringThe ID that uniquely identifies a message group
token
CancellationTokenOptional token to cancel the message processing
Returns
WaitAsync(TimeSpan)
Allows a poller to wait for when ActiveMessageCount is next decremented or when the timeout elapses
Task WaitAsync(TimeSpan timeout)
Parameters
timeout
TimeSpanMaximum amount of time to wait