Table of Contents

Interface IMessageManager

Namespace
AWS.Messaging.Services
Assembly
AWS.Messaging.dll

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

int

Methods

ProcessMessageAsync(MessageEnvelope, SubscriberMapping, CancellationToken)

Start the async processing of a message.

Task ProcessMessageAsync(MessageEnvelope messageEnvelope, SubscriberMapping subscriberMapping, CancellationToken token = default)

Parameters

messageEnvelope MessageEnvelope

The message to start processing

subscriberMapping SubscriberMapping

The mapping between the message's type and its handler

token CancellationToken

Optional token to cancel the message processing

Returns

Task

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 string

The ID that uniquely identifies a message group

token CancellationToken

Optional token to cancel the message processing

Returns

Task

WaitAsync(TimeSpan)

Allows a poller to wait for when ActiveMessageCount is next decremented or when the timeout elapses

Task WaitAsync(TimeSpan timeout)

Parameters

timeout TimeSpan

Maximum amount of time to wait

Returns

Task