Path: redb-route/redb.Route/Abstractions/IScatterGatherDefinition.cs
Snapshot: redb-route, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages.
License: Apache-2.0. Repository: https://github.com/redbase-app/redb-route
Page: https://redbase.app/src/dev-2026-12-06/redb-route/redb.Route/Abstractions/IScatterGatherDefinition.cs
----
using System;
using System.Collections.Generic;
namespace redb.Route.Abstractions;
///
/// Fluent builder for configuring a Scatter-Gather step.
/// Allows setting recipients (static or dynamic), aggregation strategy,
/// timeout, parallelism, and error handling options.
///
public interface IScatterGatherDefinition
{
/// Sets the static list of recipient endpoint URIs.
/// Endpoint URIs to scatter to.
IScatterGatherDefinition Recipients(params string[] uris);
/// Sets a dynamic recipient factory that resolves URIs from the exchange at runtime.
/// Function returning target URIs from the current exchange.
IScatterGatherDefinition Recipients(Func> factory);
/// Sets the mandatory pair-wise aggregation strategy: (accumulated, current) → merged.
/// Aggregation function applied pair-wise to collected responses.
IScatterGatherDefinition AggregationStrategy(Func strategy);
/// Sets the timeout for the entire scatter-gather operation.
/// Maximum duration to wait for all responses.
IScatterGatherDefinition Timeout(TimeSpan timeout);
/// Enables or disables parallel processing of recipients (default: true).
/// True for parallel, false for sequential.
IScatterGatherDefinition ParallelProcessing(bool parallel = true);
/// Sets the maximum degree of parallelism (0 = processor count).
/// Maximum concurrent sends.
IScatterGatherDefinition MaxDegreeOfParallelism(int maxDop);
/// Enables or disables stop-on-exception behavior (default: false).
/// True to propagate exceptions immediately, false to aggregate partial results.
IScatterGatherDefinition StopOnException(bool stop = true);
}