Interface FlowWithContextOps<Out,Ctx,Mat>
-
- All Known Implementing Classes:
FlowWithContext
,SourceWithContext
public interface FlowWithContextOps<Out,Ctx,Mat>
Shared stream operations forFlowWithContext
andSourceWithContext
that automatically propagate a context element with each data element.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description FlowWithContextOps
alsoTo(Graph<SinkShape<Out>,?> that)
Data variant ofpekko.stream.scaladsl.FlowOps.alsoTo
FlowWithContextOps
alsoToContext(Graph<SinkShape<Ctx>,?> that)
Context variant ofpekko.stream.scaladsl.FlowOps.alsoTo
<Out2> FlowWithContextOps
collect(scala.PartialFunction<Out,Out2> f)
Context-preserving variant ofpekko.stream.scaladsl.FlowOps.collect
.FlowWithContextOps
filter(scala.Function1<Out,java.lang.Object> pred)
Context-preserving variant ofpekko.stream.scaladsl.FlowOps.filter
.FlowWithContextOps
filterNot(scala.Function1<Out,java.lang.Object> pred)
Context-preserving variant ofpekko.stream.scaladsl.FlowOps.filterNot
.<T,C>
Flow<scala.Tuple2<T,C>,scala.Tuple2<T,C>,NotUsed>flow()
FlowWithContextOps
grouped(int n)
Context-preserving variant ofpekko.stream.scaladsl.FlowOps.grouped
.FlowWithContextOps
log(java.lang.String name, scala.Function1<Out,java.lang.Object> extract, LoggingAdapter log)
Context-preserving variant ofpekko.stream.scaladsl.FlowOps.log
.scala.Function1<Out,java.lang.Object>
log$default$2()
LoggingAdapter
log$default$3(java.lang.String name, scala.Function1<Out,java.lang.Object> extract)
FlowWithContextOps
logWithMarker(java.lang.String name, scala.Function2<Out,Ctx,LogMarker> marker, scala.Function1<Out,java.lang.Object> extract, MarkerLoggingAdapter log)
Context-preserving variant ofpekko.stream.scaladsl.FlowOps.logWithMarker
.scala.Function1<Out,java.lang.Object>
logWithMarker$default$3()
MarkerLoggingAdapter
logWithMarker$default$4(java.lang.String name, scala.Function2<Out,Ctx,LogMarker> marker, scala.Function1<Out,java.lang.Object> extract)
<Out2> FlowWithContextOps
map(scala.Function1<Out,Out2> f)
Context-preserving variant ofpekko.stream.scaladsl.FlowOps.map
.<Out2> FlowWithContextOps
mapAsync(int parallelism, scala.Function1<Out,scala.concurrent.Future<Out2>> f)
Context-preserving variant ofpekko.stream.scaladsl.FlowOps.mapAsync
.<Out2,P>
FlowWithContextOpsmapAsyncPartitioned(int parallelism, scala.Function1<Out,P> partitioner, scala.Function2<Out,P,scala.concurrent.Future<Out2>> f)
Context-preserving variant ofpekko.stream.scaladsl.FlowOps.mapAsyncPartitioned
.<Out2,P>
FlowWithContextOpsmapAsyncPartitionedUnordered(int parallelism, scala.Function1<Out,P> partitioner, scala.Function2<Out,P,scala.concurrent.Future<Out2>> f)
Context-preserving variant ofpekko.stream.scaladsl.FlowOps.mapAsyncPartitionedUnordered
.<Out2> FlowWithContextOps
mapConcat(scala.Function1<Out,scala.collection.IterableOnce<Out2>> f)
Context-preserving variant ofpekko.stream.scaladsl.FlowOps.mapConcat
.<Ctx2> FlowWithContextOps
mapContext(scala.Function1<Ctx,Ctx2> f)
Apply the given function to each context element (leaving the data elements unchanged).FlowWithContextOps
mapError(scala.PartialFunction<java.lang.Throwable,java.lang.Throwable> pf)
Context-preserving variant ofpekko.stream.scaladsl.FlowOps.mapError
.FlowWithContextOps
sliding(int n, int step)
Context-preserving variant ofpekko.stream.scaladsl.FlowOps.sliding
.int
sliding$default$2()
FlowWithContextOps
throttle(int elements, scala.concurrent.duration.FiniteDuration per)
Context-preserving variant ofpekko.stream.scaladsl.FlowOps.throttle
.FlowWithContextOps
throttle(int elements, scala.concurrent.duration.FiniteDuration per, int maximumBurst, ThrottleMode mode)
Context-preserving variant ofpekko.stream.scaladsl.FlowOps.throttle
.FlowWithContextOps
throttle(int cost, scala.concurrent.duration.FiniteDuration per, int maximumBurst, scala.Function1<Out,java.lang.Object> costCalculation, ThrottleMode mode)
Context-preserving variant ofpekko.stream.scaladsl.FlowOps.throttle
.FlowWithContextOps
throttle(int cost, scala.concurrent.duration.FiniteDuration per, scala.Function1<Out,java.lang.Object> costCalculation)
Context-preserving variant ofpekko.stream.scaladsl.FlowOps.throttle
.<Out2,Mat2>
FlowWithContextOpsunsafeDataVia(Graph<FlowShape<Out,Out2>,Mat2> viaFlow)
Transform this flow by the regular flow.<Out2,Ctx2,Mat2>
FlowWithContextOpsvia(Graph<FlowShape<scala.Tuple2<Out,Ctx>,scala.Tuple2<Out2,Ctx2>>,Mat2> flow)
Transform this flow by the regular flow.<Out2,Ctx2,Mat2,Mat3>
FlowWithContextOpsviaMat(Graph<FlowShape<scala.Tuple2<Out,Ctx>,scala.Tuple2<Out2,Ctx2>>,Mat2> flow, scala.Function2<Mat,Mat2,Mat3> combine)
Transform this flow by the regular flow.FlowWithContextOps
wireTap(Graph<SinkShape<Out>,?> that)
Data variant ofpekko.stream.scaladsl.FlowOps.wireTap
FlowWithContextOps
wireTapContext(Graph<SinkShape<Ctx>,?> that)
Context variant ofpekko.stream.scaladsl.FlowOps.wireTap
-
-
-
Method Detail
-
alsoTo
FlowWithContextOps alsoTo(Graph<SinkShape<Out>,?> that)
Data variant ofpekko.stream.scaladsl.FlowOps.alsoTo
- Since:
- 1.1.0
- See Also:
pekko.stream.scaladsl.FlowOps.alsoTo
-
alsoToContext
FlowWithContextOps alsoToContext(Graph<SinkShape<Ctx>,?> that)
Context variant ofpekko.stream.scaladsl.FlowOps.alsoTo
- Since:
- 1.1.0
- See Also:
pekko.stream.scaladsl.FlowOps.alsoTo
-
collect
<Out2> FlowWithContextOps collect(scala.PartialFunction<Out,Out2> f)
Context-preserving variant ofpekko.stream.scaladsl.FlowOps.collect
.Note, that the context of elements that are filtered out is skipped as well.
- See Also:
pekko.stream.scaladsl.FlowOps.collect
-
filter
FlowWithContextOps filter(scala.Function1<Out,java.lang.Object> pred)
Context-preserving variant ofpekko.stream.scaladsl.FlowOps.filter
.Note, that the context of elements that are filtered out is skipped as well.
- See Also:
pekko.stream.scaladsl.FlowOps.filter
-
filterNot
FlowWithContextOps filterNot(scala.Function1<Out,java.lang.Object> pred)
Context-preserving variant ofpekko.stream.scaladsl.FlowOps.filterNot
.Note, that the context of elements that are filtered out is skipped as well.
- See Also:
pekko.stream.scaladsl.FlowOps.filterNot
-
grouped
FlowWithContextOps grouped(int n)
Context-preserving variant ofpekko.stream.scaladsl.FlowOps.grouped
.Each output group will be associated with a
Seq
of corresponding context elements.- See Also:
pekko.stream.scaladsl.FlowOps.grouped
-
log
FlowWithContextOps log(java.lang.String name, scala.Function1<Out,java.lang.Object> extract, LoggingAdapter log)
Context-preserving variant ofpekko.stream.scaladsl.FlowOps.log
.- See Also:
pekko.stream.scaladsl.FlowOps.log
-
log$default$2
scala.Function1<Out,java.lang.Object> log$default$2()
-
log$default$3
LoggingAdapter log$default$3(java.lang.String name, scala.Function1<Out,java.lang.Object> extract)
-
logWithMarker
FlowWithContextOps logWithMarker(java.lang.String name, scala.Function2<Out,Ctx,LogMarker> marker, scala.Function1<Out,java.lang.Object> extract, MarkerLoggingAdapter log)
Context-preserving variant ofpekko.stream.scaladsl.FlowOps.logWithMarker
.- See Also:
pekko.stream.scaladsl.FlowOps.logWithMarker
-
logWithMarker$default$3
scala.Function1<Out,java.lang.Object> logWithMarker$default$3()
-
logWithMarker$default$4
MarkerLoggingAdapter logWithMarker$default$4(java.lang.String name, scala.Function2<Out,Ctx,LogMarker> marker, scala.Function1<Out,java.lang.Object> extract)
-
map
<Out2> FlowWithContextOps map(scala.Function1<Out,Out2> f)
Context-preserving variant ofpekko.stream.scaladsl.FlowOps.map
.- See Also:
pekko.stream.scaladsl.FlowOps.map
-
mapAsync
<Out2> FlowWithContextOps mapAsync(int parallelism, scala.Function1<Out,scala.concurrent.Future<Out2>> f)
Context-preserving variant ofpekko.stream.scaladsl.FlowOps.mapAsync
.- See Also:
pekko.stream.scaladsl.FlowOps.mapAsync
-
mapAsyncPartitioned
<Out2,P> FlowWithContextOps mapAsyncPartitioned(int parallelism, scala.Function1<Out,P> partitioner, scala.Function2<Out,P,scala.concurrent.Future<Out2>> f)
Context-preserving variant ofpekko.stream.scaladsl.FlowOps.mapAsyncPartitioned
.- Since:
- 1.1.0
- See Also:
pekko.stream.scaladsl.FlowOps.mapAsyncPartitioned
-
mapAsyncPartitionedUnordered
<Out2,P> FlowWithContextOps mapAsyncPartitionedUnordered(int parallelism, scala.Function1<Out,P> partitioner, scala.Function2<Out,P,scala.concurrent.Future<Out2>> f)
Context-preserving variant ofpekko.stream.scaladsl.FlowOps.mapAsyncPartitionedUnordered
.- Since:
- 1.1.0
- See Also:
pekko.stream.scaladsl.FlowOps.mapAsyncPartitionedUnordered
-
mapConcat
<Out2> FlowWithContextOps mapConcat(scala.Function1<Out,scala.collection.IterableOnce<Out2>> f)
Context-preserving variant ofpekko.stream.scaladsl.FlowOps.mapConcat
.The context of the input element will be associated with each of the output elements calculated from this input element.
Example:
def dup(element: String) = Seq(element, element)
Input:
("a", 1) ("b", 2)
inputElements.mapConcat(dup)
Output:
("a", 1) ("a", 1) ("b", 2) ("b", 2)
- See Also:
pekko.stream.scaladsl.FlowOps.mapConcat
-
mapContext
<Ctx2> FlowWithContextOps mapContext(scala.Function1<Ctx,Ctx2> f)
Apply the given function to each context element (leaving the data elements unchanged).
-
mapError
FlowWithContextOps mapError(scala.PartialFunction<java.lang.Throwable,java.lang.Throwable> pf)
Context-preserving variant ofpekko.stream.scaladsl.FlowOps.mapError
.- See Also:
pekko.stream.scaladsl.FlowOps.mapError
-
sliding
FlowWithContextOps sliding(int n, int step)
Context-preserving variant ofpekko.stream.scaladsl.FlowOps.sliding
.Each output group will be associated with a
Seq
of corresponding context elements.- See Also:
pekko.stream.scaladsl.FlowOps.sliding
-
sliding$default$2
int sliding$default$2()
-
throttle
FlowWithContextOps throttle(int elements, scala.concurrent.duration.FiniteDuration per)
Context-preserving variant ofpekko.stream.scaladsl.FlowOps.throttle
.- See Also:
pekko.stream.scaladsl.FlowOps.throttle
-
throttle
FlowWithContextOps throttle(int elements, scala.concurrent.duration.FiniteDuration per, int maximumBurst, ThrottleMode mode)
Context-preserving variant ofpekko.stream.scaladsl.FlowOps.throttle
.- See Also:
pekko.stream.scaladsl.FlowOps.throttle
-
throttle
FlowWithContextOps throttle(int cost, scala.concurrent.duration.FiniteDuration per, scala.Function1<Out,java.lang.Object> costCalculation)
Context-preserving variant ofpekko.stream.scaladsl.FlowOps.throttle
.- See Also:
pekko.stream.scaladsl.FlowOps.throttle
-
throttle
FlowWithContextOps throttle(int cost, scala.concurrent.duration.FiniteDuration per, int maximumBurst, scala.Function1<Out,java.lang.Object> costCalculation, ThrottleMode mode)
Context-preserving variant ofpekko.stream.scaladsl.FlowOps.throttle
.- See Also:
pekko.stream.scaladsl.FlowOps.throttle
-
unsafeDataVia
<Out2,Mat2> FlowWithContextOps unsafeDataVia(Graph<FlowShape<Out,Out2>,Mat2> viaFlow)
Transform this flow by the regular flow. The given flow works on the data portion of the stream and ignores the context.The given flow *must* not re-order, drop or emit multiple elements for one incoming element, the sequence of incoming contexts is re-combined with the outgoing elements of the stream. If a flow not fulfilling this requirement is used the stream will not fail but continue running in a corrupt state and re-combine incorrect pairs of elements and contexts or deadlock.
For more background on these requirements see https://pekko.apache.org/docs/pekko/current/stream/stream-context.html.
-
via
<Out2,Ctx2,Mat2> FlowWithContextOps via(Graph<FlowShape<scala.Tuple2<Out,Ctx>,scala.Tuple2<Out2,Ctx2>>,Mat2> flow)
Transform this flow by the regular flow. The given flow must support manual context propagation by taking and producing tuples of (data, context).It is up to the implementer to ensure the inner flow does not exhibit any behavior that is not expected by the downstream elements, such as reordering. For more background on these requirements see https://pekko.apache.org/docs/pekko/current/stream/stream-context.html.
This can be used as an escape hatch for operations that are not (yet) provided with automatic context propagation here.
- See Also:
pekko.stream.scaladsl.FlowOps.via
-
viaMat
<Out2,Ctx2,Mat2,Mat3> FlowWithContextOps viaMat(Graph<FlowShape<scala.Tuple2<Out,Ctx>,scala.Tuple2<Out2,Ctx2>>,Mat2> flow, scala.Function2<Mat,Mat2,Mat3> combine)
Transform this flow by the regular flow. The given flow must support manual context propagation by taking and producing tuples of (data, context).It is up to the implementer to ensure the inner flow does not exhibit any behavior that is not expected by the downstream elements, such as reordering. For more background on these requirements see https://pekko.apache.org/docs/pekko/current/stream/stream-context.html.
This can be used as an escape hatch for operations that are not (yet) provided with automatic context propagation here.
The
combine
function is used to compose the materialized values of this flow and that flow into the materialized value of the resulting Flow.- See Also:
pekko.stream.scaladsl.FlowOpsMat.viaMat
-
wireTap
FlowWithContextOps wireTap(Graph<SinkShape<Out>,?> that)
Data variant ofpekko.stream.scaladsl.FlowOps.wireTap
- Since:
- 1.1.0
- See Also:
pekko.stream.scaladsl.FlowOps.wireTap
-
wireTapContext
FlowWithContextOps wireTapContext(Graph<SinkShape<Ctx>,?> that)
Context variant ofpekko.stream.scaladsl.FlowOps.wireTap
- Since:
- 1.1.0
- See Also:
pekko.stream.scaladsl.FlowOps.wireTap
-
-