Class AggregationStrategies

Assembly: redb.Route.dll

Ready-made aggregation strategies (Apache Camel AggregationStrategies parity). Each is the
existing Func<IExchange, IExchange, IExchange> the DSL already takes, so one strategy
serves Aggregate, Multicast, ScatterGather, Split and Enrich.

Argument order is (accumulated, incoming); for Enrich that is (original, resource).
Every strategy tolerates a null accumulator (Split calls the strategy for the first fragment
with null, Camel-style) and an accumulator that is still a plain first exchange (Multicast and
Aggregate start with the first result as the accumulator).

Named forms for the XML format: .

public static class AggregationStrategies

Inheritance

Object→AggregationStrategies

Methods

ByName(string)

Resolves a strategy from its XML / configuration name: groupedBody, groupedExchange,

public static Func<IExchange, IExchange, IExchange> ByName(string name)

Concat(string)

Bodies as strings joined with separator.

public static Func<IExchange, IExchange, IExchange> Concat(string separator = "")

Custom(Func<IExchange, IExchange, IExchange>)

A caller-supplied strategy, wrapped so it reads like the others in a chain.

public static Func<IExchange, IExchange, IExchange> Custom(Func<IExchange, IExchange, IExchange> strategy)

GroupedBody()

Collects the bodies into a List<object?> in the accumulated body.

public static Func<IExchange, IExchange, IExchange> GroupedBody()

GroupedBody<T>()

Collects the bodies into a typed List<T>; a body that is not a T fails with an explicit message.

public static Func<IExchange, IExchange, IExchange> GroupedBody<T>()

GroupedExchange()

Collects the exchanges themselves into a List<IExchange> (for a Split whose fragments are processed later).

public static Func<IExchange, IExchange, IExchange> GroupedExchange()

IntoHeader(string)

Puts the incoming body into header name of the accumulated exchange — the most common Enrich.

public static Func<IExchange, IExchange, IExchange> IntoHeader(string name)

IntoProperty(string)

Puts the incoming body into exchange property key of the accumulated exchange.

public static Func<IExchange, IExchange, IExchange> IntoProperty(string key)

Max(IExpression)

Maximum of expression over the exchanges.

public static Func<IExchange, IExchange, IExchange> Max(IExpression expression)

Max(string)

Maximum of a route-language expression over the exchanges.

public static Func<IExchange, IExchange, IExchange> Max(string expression)

MergeHeaders()

Keeps the accumulated body; headers of the incoming exchange are merged in (the later one wins).

public static Func<IExchange, IExchange, IExchange> MergeHeaders()

Min(IExpression)

Minimum of expression over the exchanges.

public static Func<IExchange, IExchange, IExchange> Min(IExpression expression)

Min(string)

Minimum of a route-language expression over the exchanges.

public static Func<IExchange, IExchange, IExchange> Min(string expression)

Sum(IExpression)

Numeric sum of expression over the exchanges.

public static Func<IExchange, IExchange, IExchange> Sum(IExpression expression)

Sum(string)

Numeric sum of a route-language expression ("body.amount") over the exchanges; the running total is the accumulated body (decimal).

public static Func<IExchange, IExchange, IExchange> Sum(string expression)

UseLatest()

The incoming exchange wins (for Enrich: the response becomes the current message). Camel's default when no strategy is given.

public static Func<IExchange, IExchange, IExchange> UseLatest()

UseOriginal()

The accumulated (first / original) exchange wins; the incoming one is dropped.

public static Func<IExchange, IExchange, IExchange> UseOriginal()