FlowOps
Attributes
Members list
Value members
Concrete methods
Attaches the given ox.channels.Sink to this flow, meaning elements that pass through will also be sent to the sink. If emitting an element, or sending to the other
sink blocks, no elements will be processed until both are done. The elements are first emitted by the flow and then, only if that was successful, to the other
sink.
Attaches the given ox.channels.Sink to this flow, meaning elements that pass through will also be sent to the sink. If emitting an element, or sending to the other
sink blocks, no elements will be processed until both are done. The elements are first emitted by the flow and then, only if that was successful, to the other
sink.
If this flow fails, then failure is passed to the other
sink as well. If the other
sink is failed or complete, this becomes a failure of the returned flow (contrary to alsoToTap where it's ignored).
Value parameters
- other
-
The sink to which elements from this flow will be sent.
Attributes
- See also
-
alsoToTap for a version that drops elements when the
other
sink is not available for receive.
Attaches the given ox.channels.Sink to this flow, meaning elements that pass through will also be sent to the sink. If the other
sink is not available for receive, the elements are still emitted by the returned flow, but not sent to the other
sink.
Attaches the given ox.channels.Sink to this flow, meaning elements that pass through will also be sent to the sink. If the other
sink is not available for receive, the elements are still emitted by the returned flow, but not sent to the other
sink.
If this flow fails, then failure is passed to the other
sink as well. If the other
sink fails or closes, then failure or closure is ignored and it doesn't affect the resulting flow (contrary to alsoTo where it's propagated).
Value parameters
- other
-
The sink to which elements from this source will be sent.
Attributes
- See also
-
alsoTo for a version that ensures that elements are emitted both by the returned flow and sent to the
other
sink.
When run, the current pipeline is run asynchornously in the background, emitting elements to a buffer. The elements of the buffer are then emitted by the returned flow.
When run, the current pipeline is run asynchornously in the background, emitting elements to a buffer. The elements of the buffer are then emitted by the returned flow.
The size of the buffer is determined by the BufferCapacity that is in scope.
Any exceptions are propagated by the returned flow.
Attributes
Applies the given mapping function f
to each element emitted by this flow, for which the function is defined, and emits the result. If f
is not defined at an element, the element will be skipped.
Applies the given mapping function f
to each element emitted by this flow, for which the function is defined, and emits the result. If f
is not defined at an element, the element will be skipped.
Value parameters
- f
-
The mapping function.
Attributes
Concatenates this flow with the other
flow. The resulting flow will emit elements from this flow first, and then from the other
flow.
Concatenates this flow with the other
flow. The resulting flow will emit elements from this flow first, and then from the other
flow.
Value parameters
- other
-
The flow to be appended to this flow.
Attributes
Discard all elements emitted by this flow. The returned flow completes only when this flow completes (successfully or with an error).
Discard all elements emitted by this flow. The returned flow completes only when this flow completes (successfully or with an error).
Attributes
Drops n
elements from this flow and emits subsequent elements.
Drops n
elements from this flow and emits subsequent elements.
Value parameters
- n
-
Number of elements to be dropped.
Attributes
Emits only those elements emitted by this flow, for which f
returns true
.
Emits only those elements emitted by this flow, for which f
returns true
.
Value parameters
- f
-
The filtering function.
Attributes
Pipes the elements of child flows into the output source. If the parent source or any of the child sources emit an error, the pulling stops and the output source emits the error.
Pipes the elements of child flows into the output source. If the parent source or any of the child sources emit an error, the pulling stops and the output source emits the error.
Runs all flows concurrently in the background. The size of the buffers is determined by the BufferCapacity that is in scope.
Attributes
Chunks up the elements into groups of the specified size. The last group may be smaller due to the flow being complete.
Chunks up the elements into groups of the specified size. The last group may be smaller due to the flow being complete.
Value parameters
- n
-
The number of elements in a group.
Attributes
Chunks up the elements into groups that have a cumulative weight greater or equal to the minWeight
. The last group may be smaller due to the flow being complete.
Chunks up the elements into groups that have a cumulative weight greater or equal to the minWeight
. The last group may be smaller due to the flow being complete.
Value parameters
- costFn
-
The function that calculates the weight of an element.
- minWeight
-
The minimum cumulative weight of elements in a group.
Attributes
Chunks up the emitted elements into groups, within a time window, or limited by the cumulative weight being greater or equal to the minWeight
, whatever happens first. The timeout is reset after a group is emitted. If timeout expires and the buffer is empty, nothing is emitted. As soon as a new element is received, the flow will emit it as a single-element group and reset the timer.
Chunks up the emitted elements into groups, within a time window, or limited by the cumulative weight being greater or equal to the minWeight
, whatever happens first. The timeout is reset after a group is emitted. If timeout expires and the buffer is empty, nothing is emitted. As soon as a new element is received, the flow will emit it as a single-element group and reset the timer.
Value parameters
- costFn
-
The function that calculates the weight of an element.
- duration
-
The time window in which the elements are grouped.
- minWeight
-
The minimum cumulative weight of elements in a group if no timeout happens.
Attributes
Chunks up the emitted elements into groups, within a time window, or limited by the specified number of elements, whatever happens first. The timeout is reset after a group is emitted. If timeout expires and the buffer is empty, nothing is emitted. As soon as a new element is emitted, the flow will emit it as a single-element group and reset the timer.
Chunks up the emitted elements into groups, within a time window, or limited by the specified number of elements, whatever happens first. The timeout is reset after a group is emitted. If timeout expires and the buffer is empty, nothing is emitted. As soon as a new element is emitted, the flow will emit it as a single-element group and reset the timer.
Value parameters
- duration
-
The time window in which the elements are grouped.
- n
-
The maximum number of elements in a group.
Attributes
Emits a given number of elements (determined byc segmentSize
) from this flow to the returned flow, then emits the same number of elements from the other
flow and repeats. The order of elements in both flows is preserved.
Emits a given number of elements (determined byc segmentSize
) from this flow to the returned flow, then emits the same number of elements from the other
flow and repeats. The order of elements in both flows is preserved.
If one of the flows is done before the other, the behavior depends on the eagerCancel
flag. When set to true
, the returned flow is completed immediately, otherwise the remaining elements from the other flow are emitted by the returned flow.
Both flows are run concurrently and asynchronously.
Value parameters
- eagerComplete
-
If
true
, the returned flow is completed as soon as either of the flow completes. Iffalse
, the remaining elements of the non-completed flow are sent downstream. - other
-
The flow whose elements will be interleaved with the elements of this flow.
- segmentSize
-
The number of elements sent from each flow before switching to the other one. Default is 1.
Attributes
Intersperses elements emitted by this flow with inject
elements. The inject
element is emitted between each pair of elements.
Intersperses elements emitted by this flow with inject
elements. The inject
element is emitted between each pair of elements.
Attributes
Intersperses elements emitted by this flow with inject
elements. The start
element is emitted at the beginning; end
is emitted after the current flow emits the last element.
Intersperses elements emitted by this flow with inject
elements. The start
element is emitted at the beginning; end
is emitted after the current flow emits the last element.
Value parameters
- end
-
An element to be emitted at the end.
- inject
-
An element to be injected between the flow elements.
- start
-
An element to be emitted at the beginning.
Attributes
Applies the given mapping function f
to each element emitted by this flow. The returned flow then emits the results.
Applies the given mapping function f
to each element emitted by this flow. The returned flow then emits the results.
Value parameters
- f
-
The mapping function.
Attributes
Applies the given mapping function f
, to each element emitted by this source, transforming it into an IterableOnce of results, then the returned flow emits the results one by one. Can be used to unfold incoming sequences of elements into single elements.
Applies the given mapping function f
, to each element emitted by this source, transforming it into an IterableOnce of results, then the returned flow emits the results one by one. Can be used to unfold incoming sequences of elements into single elements.
Value parameters
- f
-
A function that transforms the element from this flow into an IterableOnce of results which are emitted one by one by the returned flow. If the result of
f
is empty, nothing is emitted by the returned channel.
Attributes
Applies the given mapping function f
to each element emitted by this flow. At most parallelism
invocations of f
are run in parallel.
Applies the given mapping function f
to each element emitted by this flow. At most parallelism
invocations of f
are run in parallel.
The mapped results are emitted in the same order, in which inputs are received. In other words, ordering is preserved.
Value parameters
- f
-
The mapping function.
- parallelism
-
An upper bound on the number of forks that run in parallel. Each fork runs the function
f
on a single element from the flow.
Attributes
Applies the given mapping function f
to each element emitted by this flow. At most parallelism
invocations of f
are run in parallel.
Applies the given mapping function f
to each element emitted by this flow. At most parallelism
invocations of f
are run in parallel.
The mapped results might be emitted out-of-order, depending on the order in which the mapping function completes.
Value parameters
- f
-
The mapping function.
- parallelism
-
An upper bound on the number of forks that run in parallel. Each fork runs the function
f
on a single element from the flow.
Attributes
Applies the given mapping function f
, using additional state, to each element emitted by this flow. The results are emitted by the returned flow. Optionally the returned flow emits an additional element, possibly based on the final state, once this flow is done.
Applies the given mapping function f
, using additional state, to each element emitted by this flow. The results are emitted by the returned flow. Optionally the returned flow emits an additional element, possibly based on the final state, once this flow is done.
The initializeState
function is called once when statefulMap
is called.
The onComplete
function is called once when this flow is done. If it returns a non-empty value, the value will be emitted by the flow, while an empty value will be ignored.
Value parameters
- f
-
A function that transforms the element from this flow and the state into a pair of the next state and the result which is emitted by the returned flow.
- initializeState
-
A function that initializes the state.
- onComplete
-
A function that transforms the final state into an optional element emitted by the returned flow. By default the final state is ignored.
Attributes
Applies the given mapping function f
, using additional state, to each element emitted by this flow. The returned flow emits the results one by one. Optionally the returned flow emits an additional element, possibly based on the final state, once this flow is done.
Applies the given mapping function f
, using additional state, to each element emitted by this flow. The returned flow emits the results one by one. Optionally the returned flow emits an additional element, possibly based on the final state, once this flow is done.
The initializeState
function is called once when statefulMap
is called.
The onComplete
function is called once when this flow is done. If it returns a non-empty value, the value will be emitted by the returned flow, while an empty value will be ignored.
Value parameters
- f
-
A function that transforms the element from this flow and the state into a pair of the next state and a scala.collection.IterableOnce of results which are emitted one by one by the returned flow. If the result of
f
is empty, nothing is emitted by the returned flow. - initializeState
-
A function that initializes the state.
- onComplete
-
A function that transforms the final state into an optional element emitted by the returned flow. By default the final state is ignored.
Attributes
Applies the given mapping function f
to each element emitted by this flow, in sequence. The given FlowSink can be used to emit an arbirary number of elements.
Applies the given mapping function f
to each element emitted by this flow, in sequence. The given FlowSink can be used to emit an arbirary number of elements.
The FlowEmit
instance provided to the f
callback should only be used on the calling thread. That is, FlowEmit
is thread-unsafe. Moreover, the instance should not be stored or captured in closures, which outlive the invocation of f
.
Value parameters
- f
-
The mapping function.
Attributes
Merges two flows into a single flow. The resulting flow emits elements from both flows in the order they are emitted. If one of the flows completes before the other, the remaining elements from the other flow are emitted by the returned flow. This can be changed with the propagateDoneLeft
and propagateDoneRight
flags.
Merges two flows into a single flow. The resulting flow emits elements from both flows in the order they are emitted. If one of the flows completes before the other, the remaining elements from the other flow are emitted by the returned flow. This can be changed with the propagateDoneLeft
and propagateDoneRight
flags.
Both flows are run concurrently in the background. The size of the buffers is determined by the BufferCapacity that is in scope.
Value parameters
- other
-
The flow to be merged with this flow.
- propagateDoneLeft
-
Should the resulting flow complete when the left flow (
this
) completes, before theother
flow. By defaultfalse
, that is any remaining elements from theother
flow are emitted. - propagateDoneRight
-
Should the resulting flow complete when the right flow (
outer
) completes, beforethis
flow. By defaultfalse
, that is any remaining elements fromthis
flow are emitted.
Attributes
Always runs f
after the flow completes, whether it's because all elements are emitted, or when there's an error.
Always runs f
after the flow completes, whether it's because all elements are emitted, or when there's an error.
Attributes
Runs f
after the flow completes successfully, that is when all elements are emitted.
Runs f
after the flow completes successfully, that is when all elements are emitted.
Attributes
Runs f
after the flow completes with an error. The error can't be recovered.
Runs f
after the flow completes with an error. The error can't be recovered.
Attributes
If this flow has no elements then elements from an alternative
flow are emitted by the returned flow. If this flow is failed then the returned flow is failed as well.
If this flow has no elements then elements from an alternative
flow are emitted by the returned flow. If this flow is failed then the returned flow is failed as well.
Value parameters
- alternative
-
An alternative flow to be used when this flow is empty.
Attributes
Prepends other
flow to this source. The resulting flow will emit elements from other
flow first, and then from the this flow.
Prepends other
flow to this source. The resulting flow will emit elements from other
flow first, and then from the this flow.
Value parameters
- other
-
The flow to be prepended to this flow.
Attributes
Creates sliding windows of elements from this flow. The window slides by step
elements. The last window may be smaller due to flow being completed.
Creates sliding windows of elements from this flow. The window slides by step
elements. The last window may be smaller due to flow being completed.
Value parameters
- n
-
The number of elements in a window.
- step
-
The number of elements the window slides by.
Attributes
Takes the first n
elements from this flow and emits them. If the flow completes before emitting n
elements, the returned flow completes as well.
Takes the first n
elements from this flow and emits them. If the flow completes before emitting n
elements, the returned flow completes as well.
Attributes
Transform the flow so that it emits elements as long as predicate f
is satisfied (returns true
). If includeFirstFailing
is true
, the flow will additionally emit the first element that failed the predicate. After that, the flow will complete as done.
Transform the flow so that it emits elements as long as predicate f
is satisfied (returns true
). If includeFirstFailing
is true
, the flow will additionally emit the first element that failed the predicate. After that, the flow will complete as done.
Value parameters
- f
-
A predicate function called on incoming elements.
- includeFirstFailing
-
Whether the flow should also emit the first element that failed the predicate (
false
by default).
Attributes
Applies the given effectful function f
to each element emitted by this flow. The returned flow emits the elements unchanged. If f
throws an exceptions, the flow fails and propagates the exception.
Applies the given effectful function f
to each element emitted by this flow. The returned flow emits the elements unchanged. If f
throws an exceptions, the flow fails and propagates the exception.
Attributes
Emits elements limiting the throughput to specific number of elements (evenly spaced) per time unit. Note that the element's emission-time time is included in the resulting throughput. For instance having throttle(1, 1.second)
and emission of the next element taking Xms
means that resulting flow will emit elements every 1s + Xms
time. Throttling is not applied to the empty source.
Emits elements limiting the throughput to specific number of elements (evenly spaced) per time unit. Note that the element's emission-time time is included in the resulting throughput. For instance having throttle(1, 1.second)
and emission of the next element taking Xms
means that resulting flow will emit elements every 1s + Xms
time. Throttling is not applied to the empty source.
Value parameters
- elements
-
Number of elements to be emitted. Must be greater than 0.
- per
-
Per time unit. Must be greater or equal to 1 ms.
Attributes
- Returns
-
A flow that emits at most
elements
per
time unit.
Combines elements from this and the other flow into tuples. Completion of either flow completes the returned flow as well. The flows are run concurrently.
Combines elements from this and the other flow into tuples. Completion of either flow completes the returned flow as well. The flows are run concurrently.
Attributes
- See also
-
zipAll
Combines elements from this and the other flow into tuples, handling early completion of either flow with defaults. The flows are run concurrently.
Combines elements from this and the other flow into tuples, handling early completion of either flow with defaults. The flows are run concurrently.
Value parameters
- other
-
A flow of elements to be combined with.
- otherDefault
-
A default element to be used in the result tuple when the current flow is longer.
- thisDefault
-
A default element to be used in the result tuple when the other flow is longer.