Table of Contents

Interface IMessageAggregator<TResult>

Namespace
DotCompute.Abstractions.Messaging
Assembly
DotCompute.Abstractions.dll

Aggregates responses from multiple requests into a single result.

public interface IMessageAggregator<TResult> : IAsyncDisposable

Type Parameters

TResult

The aggregated result type.

Inherited Members

Properties

AggregatedResult

Gets a task that completes when aggregation is complete or times out.

Task<TResult> AggregatedResult { get; }

Property Value

Task<TResult>

ExpectedCount

Gets the number of expected responses.

int ExpectedCount { get; }

Property Value

int

IsComplete

Gets a value indicating whether all expected responses have been received.

bool IsComplete { get; }

Property Value

bool

ReceivedCount

Gets the number of received responses.

int ReceivedCount { get; }

Property Value

int

Methods

AddResponseAsync<TResponse>(TResponse, CancellationToken)

Adds a response to the aggregation.

Task<bool> AddResponseAsync<TResponse>(TResponse response, CancellationToken cancellationToken = default) where TResponse : IResponseMessage

Parameters

response TResponse

The response to add.

cancellationToken CancellationToken

Cancellation token.

Returns

Task<bool>

True if aggregation is complete after adding.

Type Parameters

TResponse

The response type.

Cancel()

Cancels the aggregation and completes with partial results.

void Cancel()

MarkFailed(Guid, Exception)

Marks a specific request as failed.

void MarkFailed(Guid correlationId, Exception exception)

Parameters

correlationId Guid

The correlation ID of the failed request.

exception Exception

The exception that occurred.