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
- Alphabetic
- By Inheritance
- FlowWithContext
- GraphDelegate
- Graph
- AnyRef
- Any
- by any2stringadd
- by StringFormat
- by Ensuring
- by ArrowAssoc
- Hide All
- Show All
- Public
- All
Instance Constructors
- new FlowWithContext(delegate: scaladsl.FlowWithContext[CtxIn, In, CtxOut, Out, Mat])
Type Members
Value Members
-
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
-
def
asFlow(): Flow[Pair[In, CtxIn], Pair[Out, CtxOut], Mat]
Creates a regular flow of pairs (data, context).
- def asScala: scaladsl.FlowWithContext[CtxIn, In, CtxOut, Out, Mat]
-
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
-
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
-
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
-
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
-
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
-
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.
-
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
-
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
- def mapAsync[Out2](parallelism: Int, f: Function[Out, CompletionStage[Out2]]): FlowWithContext[CtxIn, In, CtxOut, Out2, Mat]
-
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)
-
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).
-
def
named(name: String): Graph[FlowShape[(In, CtxIn), (Out, CtxOut)], Mat]
- Definition Classes
- Graph
-
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
-
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
-
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)
-
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
-
final
def
withAttributes(attr: Attributes): Graph[FlowShape[(In, CtxIn), (Out, CtxOut)], Mat]
- Definition Classes
- GraphDelegate → Graph