Table of Contents

Interface IMessageAggregatorFactory

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

Factory for creating message aggregators.

public interface IMessageAggregatorFactory

Methods

CreateAggregator<TResponse, TResult>(int, Func<IReadOnlyList<TResponse>, TResult>, TimeSpan, CancellationToken)

Creates a new aggregator that combines responses into a single result.

IMessageAggregator<TResult> CreateAggregator<TResponse, TResult>(int expectedCount, Func<IReadOnlyList<TResponse>, TResult> aggregateFunc, TimeSpan timeout, CancellationToken cancellationToken = default) where TResponse : IResponseMessage

Parameters

expectedCount int

Number of expected responses.

aggregateFunc Func<IReadOnlyList<TResponse>, TResult>

Function to aggregate responses.

timeout TimeSpan

Timeout for aggregation.

cancellationToken CancellationToken

Cancellation token.

Returns

IMessageAggregator<TResult>

A new message aggregator.

Type Parameters

TResponse

The response type.

TResult

The aggregated result type.

CreateFirstSuccess<TResponse>(int, TimeSpan, CancellationToken)

Creates a new aggregator that returns the first successful response.

IMessageAggregator<TResponse?> CreateFirstSuccess<TResponse>(int expectedCount, TimeSpan timeout, CancellationToken cancellationToken = default) where TResponse : class, IResponseMessage

Parameters

expectedCount int

Number of expected responses.

timeout TimeSpan

Timeout for aggregation.

cancellationToken CancellationToken

Cancellation token.

Returns

IMessageAggregator<TResponse>

A new message aggregator that returns the first success.

Type Parameters

TResponse

The response type.

CreateWaitAll<TResponse>(int, TimeSpan, CancellationToken)

Creates a new aggregator that waits for all responses.

IMessageAggregator<IReadOnlyList<TResponse>> CreateWaitAll<TResponse>(int expectedCount, TimeSpan timeout, CancellationToken cancellationToken = default) where TResponse : IResponseMessage

Parameters

expectedCount int

Number of expected responses.

timeout TimeSpan

Timeout for aggregation.

cancellationToken CancellationToken

Cancellation token.

Returns

IMessageAggregator<IReadOnlyList<TResponse>>

A new message aggregator that returns all responses.

Type Parameters

TResponse

The response type.