final class SourceWithContext[+Ctx, +Out, +Mat] extends GraphDelegate[SourceShape[(Out, Ctx)], Mat] with FlowWithContextOps[Ctx, Out, Mat]
A source that provides operations which automatically propagate the context of an element. Only a subset of common operations from FlowOps is supported. As an escape hatch you can use FlowWithContextOps.via to manually provide the context propagation for otherwise unsupported operations.
Can be created by calling Source.startContextPropagation()
API MAY CHANGE
- Annotations
- @ApiMayChange()
- Source
- SourceWithContext.scala
- Alphabetic
- By Inheritance
- SourceWithContext
- FlowWithContextOps
- GraphDelegate
- Graph
- AnyRef
- Any
- by any2stringadd
- by StringFormat
- by Ensuring
- by ArrowAssoc
- Hide All
- Show All
- Public
- All
Type Members
-
type
Repr[+C, +O] = ReprMat[C, O, Mat]
- Definition Classes
- FlowWithContextOps
-
type
ReprMat[+C, +O, +M] = SourceWithContext[C, O, M]
- Definition Classes
- SourceWithContext → FlowWithContextOps
-
type
Shape = SourceShape[(Out, Ctx)]
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
-
def
addAttributes(attr: Attributes): Graph[SourceShape[(Out, Ctx)], 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 asJava[JCtx >: Ctx, JOut >: Out, JMat >: Mat]: javadsl.SourceWithContext[JCtx, JOut, JMat]
-
def
async(dispatcher: String, inputBufferSize: Int): Graph[SourceShape[(Out, Ctx)], 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[SourceShape[(Out, Ctx)], 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[SourceShape[(Out, Ctx)], Mat]
Put an asynchronous boundary around this
Graph
Put an asynchronous boundary around this
Graph
- Definition Classes
- Graph
-
def
collect[Out2](f: PartialFunction[Out, Out2]): Repr[Ctx, Out2]
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.
- Definition Classes
- FlowWithContextOps
- See also
-
def
endContextPropagation: Source[(Out, Ctx), Mat]
Stops automatic context propagation from here and converts this to a regular stream of a pair of (data, context).
-
def
filter(pred: (Out) ⇒ Boolean): Repr[Ctx, Out]
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.
- Definition Classes
- FlowWithContextOps
- See also
-
def
filterNot(pred: (Out) ⇒ Boolean): Repr[Ctx, Out]
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.
- Definition Classes
- FlowWithContextOps
- See also
-
def
grouped(n: Int): Repr[Seq[Ctx], Seq[Out]]
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.- Definition Classes
- FlowWithContextOps
- See also
-
def
map[Out2](f: (Out) ⇒ Out2): Repr[Ctx, Out2]
Context-preserving variant of akka.stream.scaladsl.FlowOps.map.
Context-preserving variant of akka.stream.scaladsl.FlowOps.map.
- Definition Classes
- FlowWithContextOps
- See also
-
def
mapAsync[Out2](parallelism: Int)(f: (Out) ⇒ Future[Out2]): Repr[Ctx, Out2]
Context-preserving variant of akka.stream.scaladsl.FlowOps.mapAsync.
Context-preserving variant of akka.stream.scaladsl.FlowOps.mapAsync.
- Definition Classes
- FlowWithContextOps
- See also
-
def
mapConcat[Out2](f: (Out) ⇒ Iterable[Out2]): Repr[Ctx, Out2]
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)
- Definition Classes
- FlowWithContextOps
- See also
-
def
mapContext[Ctx2](f: (Ctx) ⇒ Ctx2): Repr[Ctx2, Out]
Apply the given function to each context element (leaving the data elements unchanged).
Apply the given function to each context element (leaving the data elements unchanged).
- Definition Classes
- FlowWithContextOps
-
def
named(name: String): Graph[SourceShape[(Out, Ctx)], Mat]
- Definition Classes
- Graph
-
final
def
shape: SourceShape[(Out, Ctx)]
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): Repr[Seq[Ctx], Seq[Out]]
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.- Definition Classes
- FlowWithContextOps
- See also
-
def
statefulMapConcat[Out2](f: () ⇒ (Out) ⇒ Iterable[Out2]): Repr[Ctx, Out2]
Context-preserving variant of akka.stream.scaladsl.FlowOps.statefulMapConcat.
Context-preserving variant of akka.stream.scaladsl.FlowOps.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)
- Definition Classes
- FlowWithContextOps
- See also
-
def
via[Ctx2, Out2, Mat2](viaFlow: Graph[FlowShape[(Out, Ctx), (Out2, Ctx2)], Mat2]): Repr[Ctx2, Out2]
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.
- Definition Classes
- SourceWithContext → FlowWithContextOps
- See also
-
def
viaMat[Ctx2, Out2, Mat2, Mat3](flow: Graph[FlowShape[(Out, Ctx), (Out2, Ctx2)], Mat2])(combine: (Mat, Mat2) ⇒ Mat3): SourceWithContext[Ctx2, Out2, 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).
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.- Definition Classes
- SourceWithContext → FlowWithContextOps
- See also
akka.stream.scaladsl.FlowOps.viaMat
-
final
def
withAttributes(attr: Attributes): Graph[SourceShape[(Out, Ctx)], Mat]
- Definition Classes
- GraphDelegate → Graph