final class SourceWithContext[+Out, +Ctx, +Mat] extends GraphDelegate[SourceShape[(Out, Ctx)], Mat]

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

Can be created by calling Source.asSourceWithContext()

API MAY CHANGE

Annotations
@ApiMayChange()
Source
SourceWithContext.scala
Linear Supertypes
GraphDelegate[SourceShape[(Out, Ctx)], Mat], Graph[SourceShape[(Out, Ctx)], Mat], AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. SourceWithContext
  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 SourceWithContext(delegate: scaladsl.SourceWithContext[Out, Ctx, Mat])

Type Members

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

  1. 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
  2. def asScala: scaladsl.SourceWithContext[Out, Ctx, Mat]
  3. def asSource(): Source[Pair[Out, Ctx], Mat]

    Stops automatic context propagation from here and converts this to a regular stream of a pair of (data, context).

  4. 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
  5. 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
  6. def async: Graph[SourceShape[(Out, Ctx)], 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]): SourceWithContext[Out2, Ctx, Mat]

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

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

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

    See also

    akka.stream.javadsl.Source.collect

  8. def filter(p: Predicate[Out]): SourceWithContext[Out, Ctx, Mat]

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

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

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

    See also

    akka.stream.javadsl.Source.filter

  9. def filterNot(p: Predicate[Out]): SourceWithContext[Out, Ctx, Mat]

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

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

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

    See also

    akka.stream.javadsl.Source.filterNot

  10. def grouped(n: Int): SourceWithContext[List[Out], List[Ctx], Mat]

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

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

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

    See also

    akka.stream.javadsl.Source.grouped

  11. def log(name: String): SourceWithContext[Out, Ctx, Mat]

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

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

    See also

    akka.stream.javadsl.Flow.log

  12. def log(name: String, log: LoggingAdapter): SourceWithContext[Out, Ctx, Mat]

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

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

    See also

    akka.stream.javadsl.Flow.log

  13. def log(name: String, extract: Function[Out, Any]): SourceWithContext[Out, Ctx, Mat]

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

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

    See also

    akka.stream.javadsl.Flow.log

  14. def log(name: String, extract: Function[Out, Any], log: LoggingAdapter): SourceWithContext[Out, Ctx, Mat]

    Context-preserving variant of akka.stream.javadsl.Source.log.

    Context-preserving variant of akka.stream.javadsl.Source.log.

    See also

    akka.stream.javadsl.Source.log

  15. def map[Out2](f: Function[Out, Out2]): SourceWithContext[Out2, Ctx, Mat]

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

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

    See also

    akka.stream.javadsl.Source.map

  16. def mapAsync[Out2](parallelism: Int, f: Function[Out, CompletionStage[Out2]]): SourceWithContext[Out2, Ctx, Mat]
  17. def mapConcat[Out2](f: Function[Out, _ <: Iterable[Out2]]): SourceWithContext[Out2, Ctx, Mat]

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

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

  18. def mapContext[Ctx2](extractContext: Function[Ctx, Ctx2]): SourceWithContext[Out, Ctx2, Mat]

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

  19. def mapMaterializedValue[Mat2](f: Function[Mat, Mat2]): SourceWithContext[Out, Ctx, Mat2]

    Context-preserving variant of akka.stream.javadsl.Source.mapMaterializedValue.

  20. def named(name: String): Graph[SourceShape[(Out, Ctx)], Mat]
    Definition Classes
    Graph
  21. def runWith[M](sink: Graph[SinkShape[Pair[Out, Ctx]], M], materializer: Materializer): M

    Connect this akka.stream.javadsl.SourceWithContext to a akka.stream.javadsl.Sink and run it.

    Connect this akka.stream.javadsl.SourceWithContext to a akka.stream.javadsl.Sink and run it. The returned value is the materialized value of the Sink.

  22. 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
  23. def sliding(n: Int, step: Int = 1): SourceWithContext[List[Out], List[Ctx], Mat]

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

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

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

    See also

    akka.stream.javadsl.Source.sliding

  24. def to[Mat2](sink: Graph[SinkShape[Pair[Out, Ctx]], Mat2]): RunnableGraph[Mat]

    Connect this akka.stream.javadsl.SourceWithContext to a akka.stream.javadsl.Sink, concatenating the processing steps of both.

  25. def toMat[Mat2, Mat3](sink: Graph[SinkShape[Pair[Out, Ctx]], Mat2], combine: Function2[Mat, Mat2, Mat3]): RunnableGraph[Mat3]

    Connect this akka.stream.javadsl.SourceWithContext to a akka.stream.javadsl.Sink, concatenating the processing steps of both.

  26. def via[Out2, Ctx2, Mat2](viaFlow: Graph[FlowShape[Pair[Out, Ctx], Pair[Out2, Ctx2]], Mat2]): SourceWithContext[Out2, Ctx2, 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

  27. def withAttributes(attr: Attributes): SourceWithContext[Out, Ctx, Mat]

    Context-preserving variant of akka.stream.javadsl.Source.withAttributes.