| SubFlowOperationsBatchWeightedTOut, TOut2, TMat, TClosed Method |
Allows a faster upstream to progress independently of a slower subscriber by aggregating elements into batches
until the subscriber is ready to accept them.For example a batch step might concatenate
ByteString
elements up to the allowed max limit if the upstream publisher is faster.
This element only rolls up elements if the upstream is faster, but if the downstream is faster it will not
duplicate elements.
Batching will apply for all elements, even if a single element cost is greater than the total allowed limit.
In this case, previous batched elements will be emitted, then the "heavy" element will be emitted (after
being applied with the
seed function) without batching further elements with it, and then the rest of the
incoming elements are batched.
Emits when downstream stops backpressuring and there is a batched element available
Backpressures when there are
max weighted batched elements + 1 pending element and downstream backpressures
Completes when upstream completes and there is no batched/pending element waiting
Cancels when downstream cancels
See also ,
Namespace:
Akka.Streams.Dsl
Assembly:
Akka.Streams (in Akka.Streams.dll) Version: 1.2.3.42 (1.2.3.42)
Syntax public static SubFlow<TOut2, TMat, TClosed> BatchWeighted<TOut, TOut2, TMat, TClosed>(
this SubFlow<TOut, TMat, TClosed> flow,
long max,
Func<TOut, long> costFunction,
Func<TOut, TOut2> seed,
Func<TOut2, TOut, TOut2> aggregate
)
[<ExtensionAttribute>]
static member BatchWeighted :
flow : SubFlow<'TOut, 'TMat, 'TClosed> *
max : int64 *
costFunction : Func<'TOut, int64> *
seed : Func<'TOut, 'TOut2> *
aggregate : Func<'TOut2, 'TOut, 'TOut2> -> SubFlow<'TOut2, 'TMat, 'TClosed>
Parameters
- flow
- Type: Akka.Streams.DslSubFlowTOut, TMat, TClosed
TBD - max
- Type: SystemInt64
maximum weight of elements to batch before backpressuring upstream (must be positive non-zero) - costFunction
- Type: SystemFuncTOut, Int64
a function to compute a single element weight - seed
- Type: SystemFuncTOut, TOut2
Provides the first state for a batched value using the first unconsumed element as a start - aggregate
- Type: SystemFuncTOut2, TOut, TOut2
Takes the currently batched value and the current pending element to produce a new aggregate
Type Parameters
- TOut
- TBD
- TOut2
- TBD
- TMat
- TBD
- TClosed
- TBD
Return Value
Type:
SubFlowTOut2,
TMat,
TClosedTBD
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type
SubFlowTOut,
TMat,
TClosed. When you use instance method syntax to call this method, omit the first parameter. For more information, see
Extension Methods (Visual Basic) or
Extension Methods (C# Programming Guide).
See Also Reference
SubFlowOperationsConflateWithSeedTOut, TMat, TSeed, TClosed(SubFlowTOut, TMat, TClosed, FuncTOut, TSeed, FuncTSeed, TOut, TSeed) SubFlowOperationsBatchTOut, TOut2, TMat, TClosed(SubFlowTOut, TMat, TClosed, Int64, FuncTOut, TOut2, FuncTOut2, TOut, TOut2)