final class FlowWithContext[-CtxIn, -In, +CtxOut, +Out, +Mat] extends GraphDelegate[FlowShape[(In, CtxIn), (Out, CtxOut)], Mat]

A flow that provides operations which automatically propagate the context of an element. Only a subset of common operations from Flow is supported. As an escape hatch you can use FlowWithContext.via to manually provide the context propagation for otherwise unsupported operations.

An "empty" flow can be created by calling FlowWithContext[Ctx, T].

API MAY CHANGE

Annotations
@ApiMayChange()
Source
FlowWithContext.scala
Linear Supertypes
GraphDelegate[FlowShape[(In, CtxIn), (Out, CtxOut)], Mat], Graph[FlowShape[(In, CtxIn), (Out, CtxOut)], Mat], AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. FlowWithContext
  2. GraphDelegate
  3. Graph
  4. AnyRef
  5. Any
Implicitly
  1. by any2stringadd
  2. by StringFormat
  3. by Ensuring
  4. by ArrowAssoc
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new FlowWithContext(delegate: scaladsl.FlowWithContext[CtxIn, In, CtxOut, Out, Mat])

Type Members

  1. type Shape = FlowShape[(In, CtxIn), (Out, CtxOut)]

    Type-level accessor for the shape parameter of this graph.

    Type-level accessor for the shape parameter of this graph.

    Definition Classes
    Graph

Value Members

  1. def addAttributes(attr: Attributes): Graph[FlowShape[(In, CtxIn), (Out, CtxOut)], Mat]

    Add the given attributes to this Graph.

    Add the given attributes to this Graph. If the specific attribute was already present on this graph this means the added attribute will be more specific than the existing one. If this Source is a composite of multiple graphs, new attributes on the composite will be less specific than attributes set directly on the individual graphs of the composite.

    Definition Classes
    Graph
  2. def asFlow(): Flow[Pair[In, CtxIn], Pair[Out, CtxOut], Mat]

    Creates a regular flow of pairs (data, context).

  3. def asScala: scaladsl.FlowWithContext[CtxIn, In, CtxOut, Out, Mat]
  4. def async(dispatcher: String, inputBufferSize: Int): Graph[FlowShape[(In, CtxIn), (Out, CtxOut)], Mat]

    Put an asynchronous boundary around this Graph

    Put an asynchronous boundary around this Graph

    dispatcher

    Run the graph on this dispatcher

    inputBufferSize

    Set the input buffer to this size for the graph

    Definition Classes
    Graph
  5. def async(dispatcher: String): Graph[FlowShape[(In, CtxIn), (Out, CtxOut)], Mat]

    Put an asynchronous boundary around this Graph

    Put an asynchronous boundary around this Graph

    dispatcher

    Run the graph on this dispatcher

    Definition Classes
    Graph
  6. def async: Graph[FlowShape[(In, CtxIn), (Out, CtxOut)], Mat]

    Put an asynchronous boundary around this Graph

    Put an asynchronous boundary around this Graph

    Definition Classes
    Graph
  7. def collect[Out2](pf: PartialFunction[Out, Out2]): FlowWithContext[CtxIn, In, CtxOut, Out2, Mat]

    Context-preserving variant of akka.stream.javadsl.Flow.collect.

    Context-preserving variant of akka.stream.javadsl.Flow.collect.

    Note, that the context of elements that are filtered out is skipped as well.

    See also

    akka.stream.javadsl.Flow.collect

  8. def filter(p: Predicate[Out]): FlowWithContext[CtxIn, In, CtxOut, Out, Mat]

    Context-preserving variant of akka.stream.javadsl.Flow.filter.

    Context-preserving variant of akka.stream.javadsl.Flow.filter.

    Note, that the context of elements that are filtered out is skipped as well.

    See also

    akka.stream.javadsl.Flow.filter

  9. def filterNot(p: Predicate[Out]): FlowWithContext[CtxIn, In, CtxOut, Out, Mat]

    Context-preserving variant of akka.stream.javadsl.Flow.filterNot.

    Context-preserving variant of akka.stream.javadsl.Flow.filterNot.

    Note, that the context of elements that are filtered out is skipped as well.

    See also

    akka.stream.javadsl.Flow.filterNot

  10. def grouped(n: Int): FlowWithContext[CtxIn, In, List[CtxOut], List[Out], Mat]

    Context-preserving variant of akka.stream.javadsl.Flow.grouped.

    Context-preserving variant of akka.stream.javadsl.Flow.grouped.

    Each output group will be associated with a Seq of corresponding context elements.

    See also

    akka.stream.javadsl.Flow.grouped

  11. def map[Out2](f: Function[Out, Out2]): FlowWithContext[CtxIn, In, CtxOut, Out2, Mat]

    Context-preserving variant of akka.stream.javadsl.Flow.map.

    Context-preserving variant of akka.stream.javadsl.Flow.map.

    See also

    akka.stream.javadsl.Flow.map

  12. def mapAsync[Out2](parallelism: Int, f: Function[Out, CompletionStage[Out2]]): FlowWithContext[CtxIn, In, CtxOut, Out2, Mat]
  13. def mapConcat[Out2](f: Function[Out, _ <: Iterable[Out2]]): FlowWithContext[CtxIn, In, CtxOut, Out2, Mat]

    Context-preserving variant of akka.stream.javadsl.Flow.mapConcat.

    Context-preserving variant of akka.stream.javadsl.Flow.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

    akka.stream.javadsl.Flow.mapConcat

  14. def mapContext[CtxOut2](extractContext: Function[CtxOut, CtxOut2]): FlowWithContext[CtxIn, In, CtxOut2, Out, Mat]

    Apply the given function to each context element (leaving the data elements unchanged).

  15. def named(name: String): Graph[FlowShape[(In, CtxIn), (Out, CtxOut)], Mat]
    Definition Classes
    Graph
  16. final def shape: FlowShape[(In, CtxIn), (Out, CtxOut)]

    The shape of a graph is all that is externally visible: its inlets and outlets.

    The shape of a graph is all that is externally visible: its inlets and outlets.

    Definition Classes
    GraphDelegate → Graph
  17. def sliding(n: Int, step: Int = 1): FlowWithContext[CtxIn, In, List[CtxOut], List[Out], Mat]

    Context-preserving variant of akka.stream.javadsl.Flow.sliding.

    Context-preserving variant of akka.stream.javadsl.Flow.sliding.

    Each output group will be associated with a Seq of corresponding context elements.

    See also

    akka.stream.javadsl.Flow.sliding

  18. def statefulMapConcat[Out2](f: Creator[Function[Out, Iterable[Out2]]]): FlowWithContext[CtxIn, In, CtxOut, Out2, Mat]

    Context-preserving variant of akka.stream.javadsl.Flow.statefulMapConcat.

    Context-preserving variant of akka.stream.javadsl.Flow.statefulMapConcat.

    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.statefulMapConcat(() => dup)

    Output:

    ("a", 1) ("a", 1) ("b", 2) ("b", 2)

    See also

    akka.stream.javadsl.Flow.statefulMapConcat

  19. def via[CtxOut2, Out2, Mat2](viaFlow: Graph[FlowShape[Pair[Out, CtxOut], Pair[Out2, CtxOut2]], Mat2]): FlowWithContext[CtxIn, In, CtxOut2, Out2, Mat]

    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).

    This can be used as an escape hatch for operations that are not (yet) provided with automatic context propagation here.

    See also

    akka.stream.javadsl.Flow.via

  20. final def withAttributes(attr: Attributes): Graph[FlowShape[(In, CtxIn), (Out, CtxOut)], Mat]
    Definition Classes
    GraphDelegate → Graph