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
expectedCountintNumber of expected responses.
aggregateFuncFunc<IReadOnlyList<TResponse>, TResult>Function to aggregate responses.
timeoutTimeSpanTimeout for aggregation.
cancellationTokenCancellationTokenCancellation token.
Returns
- IMessageAggregator<TResult>
A new message aggregator.
Type Parameters
TResponseThe response type.
TResultThe 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
expectedCountintNumber of expected responses.
timeoutTimeSpanTimeout for aggregation.
cancellationTokenCancellationTokenCancellation token.
Returns
- IMessageAggregator<TResponse>
A new message aggregator that returns the first success.
Type Parameters
TResponseThe 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
expectedCountintNumber of expected responses.
timeoutTimeSpanTimeout for aggregation.
cancellationTokenCancellationTokenCancellation token.
Returns
- IMessageAggregator<IReadOnlyList<TResponse>>
A new message aggregator that returns all responses.
Type Parameters
TResponseThe response type.