trait FlowWithContextOps[+Out, +Ctx, +Mat] extends AnyRef
Shared stream operations for FlowWithContext and SourceWithContext that automatically propagate a context element with each data element.
- Annotations
- @ccompatUsedUntil213()
- Source
- FlowWithContextOps.scala
- Alphabetic
- By Inheritance
- FlowWithContextOps
- AnyRef
- Any
- by any2stringadd
- by StringFormat
- by Ensuring
- by ArrowAssoc
- Hide All
- Show All
- Public
- Protected
Type Members
- type Repr[+O, +C] = ReprMat[O, C, Mat]
- abstract type ReprMat[+O, +C, +M] <: FlowWithContextOps[O, C, M] { type ReprMat[+OO, +CC, +MatMat] = FlowWithContextOps.this.ReprMat[OO,CC,MatMat] }
Abstract Value Members
- abstract def unsafeDataVia[Out2, Mat2](viaFlow: Graph[FlowShape[Out, Out2], Mat2]): Repr[Out2, Ctx]
Transform this flow by the regular flow.
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://doc.akka.io/libraries/akka-core/current/stream/stream-context.html.
- Annotations
- @ApiMayChange()
- abstract def via[Out2, Ctx2, Mat2](flow: Graph[FlowShape[(Out, Ctx), (Out2, Ctx2)], Mat2]): Repr[Out2, Ctx2]
Transform this flow by the regular 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 behaviour that is not expected by the downstream elements, such as reordering. For more background on these requirements see https://doc.akka.io/libraries/akka-core/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
- abstract def viaMat[Out2, Ctx2, Mat2, Mat3](flow: Graph[FlowShape[(Out, Ctx), (Out2, Ctx2)], Mat2])(combine: (Mat, Mat2) => Mat3): ReprMat[Out2, Ctx2, Mat3]
Transform this flow by the regular 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 behaviour that is not expected by the downstream elements, such as reordering. For more background on these requirements see https://doc.akka.io/libraries/akka-core/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.
Concrete Value Members
- def collect[Out2](f: PartialFunction[Out, Out2]): Repr[Out2, Ctx]
Context-preserving variant of akka.stream.scaladsl.FlowOps.collect.
Context-preserving variant of akka.stream.scaladsl.FlowOps.collect.
Note, that the context of elements that are filtered out is skipped as well.
- def filter(pred: (Out) => Boolean): Repr[Out, Ctx]
Context-preserving variant of akka.stream.scaladsl.FlowOps.filter.
Context-preserving variant of akka.stream.scaladsl.FlowOps.filter.
Note, that the context of elements that are filtered out is skipped as well.
- def filterNot(pred: (Out) => Boolean): Repr[Out, Ctx]
Context-preserving variant of akka.stream.scaladsl.FlowOps.filterNot.
Context-preserving variant of akka.stream.scaladsl.FlowOps.filterNot.
Note, that the context of elements that are filtered out is skipped as well.
- def grouped(n: Int): Repr[Seq[Out], Seq[Ctx]]
Context-preserving variant of akka.stream.scaladsl.FlowOps.grouped.
Context-preserving variant of akka.stream.scaladsl.FlowOps.grouped.
Each output group will be associated with a
Seq
of corresponding context elements. - def log(name: String, extract: (Out) => Any = ConstantFun.scalaIdentityFunction)(implicit log: LoggingAdapter = null): Repr[Out, Ctx]
Context-preserving variant of akka.stream.scaladsl.FlowOps.log.
Context-preserving variant of akka.stream.scaladsl.FlowOps.log.
- See also
- def logWithMarker(name: String, marker: (Out, Ctx) => LogMarker, extract: (Out) => Any = ConstantFun.scalaIdentityFunction)(implicit log: MarkerLoggingAdapter = null): Repr[Out, Ctx]
Context-preserving variant of akka.stream.scaladsl.FlowOps.logWithMarker.
Context-preserving variant of akka.stream.scaladsl.FlowOps.logWithMarker.
- def map[Out2](f: (Out) => Out2): Repr[Out2, Ctx]
Context-preserving variant of akka.stream.scaladsl.FlowOps.map.
Context-preserving variant of akka.stream.scaladsl.FlowOps.map.
- See also
- def mapAsync[Out2](parallelism: Int)(f: (Out) => Future[Out2]): Repr[Out2, Ctx]
Context-preserving variant of akka.stream.scaladsl.FlowOps.mapAsync.
Context-preserving variant of akka.stream.scaladsl.FlowOps.mapAsync.
- def mapConcat[Out2](f: (Out) => IterableOnce[Out2]): Repr[Out2, Ctx]
Context-preserving variant of akka.stream.scaladsl.FlowOps.mapConcat.
Context-preserving variant of akka.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)
- def mapContext[Ctx2](f: (Ctx) => Ctx2): Repr[Out, Ctx2]
Apply the given function to each context element (leaving the data elements unchanged).
- def mapError(pf: PartialFunction[Throwable, Throwable]): Repr[Out, Ctx]
Context-preserving variant of akka.stream.scaladsl.FlowOps.mapError.
Context-preserving variant of akka.stream.scaladsl.FlowOps.mapError.
- def sliding(n: Int, step: Int = 1): Repr[Seq[Out], Seq[Ctx]]
Context-preserving variant of akka.stream.scaladsl.FlowOps.sliding.
Context-preserving variant of akka.stream.scaladsl.FlowOps.sliding.
Each output group will be associated with a
Seq
of corresponding context elements. - def throttle(cost: Int, per: FiniteDuration, maximumBurst: Int, costCalculation: (Out) => Int, mode: ThrottleMode): Repr[Out, Ctx]
Context-preserving variant of akka.stream.scaladsl.FlowOps.throttle.
Context-preserving variant of akka.stream.scaladsl.FlowOps.throttle.
- def throttle(cost: Int, per: FiniteDuration, costCalculation: (Out) => Int): Repr[Out, Ctx]
Context-preserving variant of akka.stream.scaladsl.FlowOps.throttle.
Context-preserving variant of akka.stream.scaladsl.FlowOps.throttle.
- def throttle(elements: Int, per: FiniteDuration, maximumBurst: Int, mode: ThrottleMode): Repr[Out, Ctx]
Context-preserving variant of akka.stream.scaladsl.FlowOps.throttle.
Context-preserving variant of akka.stream.scaladsl.FlowOps.throttle.
- def throttle(elements: Int, per: FiniteDuration): Repr[Out, Ctx]
Context-preserving variant of akka.stream.scaladsl.FlowOps.throttle.
Context-preserving variant of akka.stream.scaladsl.FlowOps.throttle.