Table of Contents

Interface IMessageChannelReceiver<TMessage>

Namespace
Excalibur.Dispatch
Assembly
Excalibur.Dispatch.Abstractions.dll

Defines the receive-side contract for a message channel.

public interface IMessageChannelReceiver<TMessage> where TMessage : class

Type Parameters

TMessage

The type of message handled by the channel.

Extension Methods

Methods

ReceiveAsync(CancellationToken)

Receives a message from the channel.

Task<TMessage?> ReceiveAsync(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

A cancellation token to cancel the operation.

Returns

Task<TMessage>

A task that represents the asynchronous receive operation. The task result contains the received message, or null if no message is available.

ReceiveBatchAsync(int, CancellationToken)

Receives a batch of messages from the channel.

Task<IEnumerable<TMessage>> ReceiveBatchAsync(int maxMessages, CancellationToken cancellationToken)

Parameters

maxMessages int

The maximum number of messages to receive.

cancellationToken CancellationToken

A cancellation token to cancel the operation.

Returns

Task<IEnumerable<TMessage>>

A task that represents the asynchronous batch receive operation. The task result contains the received messages.