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

Source
SourceWithContext.scala
Linear Supertypes
GraphDelegate[SourceShape[(Out, Ctx)], Mat], Graph[SourceShape[(Out, Ctx)], Mat], AnyRef, Any
Type Hierarchy
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. SourceWithContext
  2. GraphDelegate
  3. Graph
  4. AnyRef
  5. Any
Implicitly
  1. by GraphMapMatVal
  2. by any2stringadd
  3. by StringFormat
  4. by Ensuring
  5. by ArrowAssoc
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

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. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. def +(other: String): String
    Implicit
    This member is added by an implicit conversion from SourceWithContext[Out, Ctx, Mat] toany2stringadd[SourceWithContext[Out, Ctx, Mat]] performed by method any2stringadd in scala.Predef.
    Definition Classes
    any2stringadd
  4. def ->[B](y: B): (SourceWithContext[Out, Ctx, Mat], B)
    Implicit
    This member is added by an implicit conversion from SourceWithContext[Out, Ctx, Mat] toArrowAssoc[SourceWithContext[Out, Ctx, Mat]] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc
    Annotations
    @inline()
  5. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  6. 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
  7. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  8. def asScala: scaladsl.SourceWithContext[Out, Ctx, Mat]
  9. 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).

  10. 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
  11. 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
  12. def async: Graph[SourceShape[(Out, Ctx)], Mat]

    Put an asynchronous boundary around this Graph

    Put an asynchronous boundary around this Graph

    Definition Classes
    Graph
  13. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @HotSpotIntrinsicCandidate() @native()
  14. 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

  15. def ensuring(cond: (SourceWithContext[Out, Ctx, Mat]) => Boolean, msg: => Any): SourceWithContext[Out, Ctx, Mat]
    Implicit
    This member is added by an implicit conversion from SourceWithContext[Out, Ctx, Mat] toEnsuring[SourceWithContext[Out, Ctx, Mat]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  16. def ensuring(cond: (SourceWithContext[Out, Ctx, Mat]) => Boolean): SourceWithContext[Out, Ctx, Mat]
    Implicit
    This member is added by an implicit conversion from SourceWithContext[Out, Ctx, Mat] toEnsuring[SourceWithContext[Out, Ctx, Mat]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  17. def ensuring(cond: Boolean, msg: => Any): SourceWithContext[Out, Ctx, Mat]
    Implicit
    This member is added by an implicit conversion from SourceWithContext[Out, Ctx, Mat] toEnsuring[SourceWithContext[Out, Ctx, Mat]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  18. def ensuring(cond: Boolean): SourceWithContext[Out, Ctx, Mat]
    Implicit
    This member is added by an implicit conversion from SourceWithContext[Out, Ctx, Mat] toEnsuring[SourceWithContext[Out, Ctx, Mat]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  19. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  20. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  21. 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

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

  23. def getAttributes: Attributes
    Definition Classes
    Graph
  24. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @HotSpotIntrinsicCandidate() @native()
  25. 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

  26. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @HotSpotIntrinsicCandidate() @native()
  27. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  28. 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

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

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

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

  32. def logWithMarker(name: String, marker: Function2[Out, Ctx, LogMarker]): SourceWithContext[Out, Ctx, Mat]

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

  33. def logWithMarker(name: String, marker: Function2[Out, Ctx, LogMarker], log: MarkerLoggingAdapter): SourceWithContext[Out, Ctx, Mat]

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

  34. def logWithMarker(name: String, marker: Function2[Out, Ctx, LogMarker], extract: Function[Out, Any]): SourceWithContext[Out, Ctx, Mat]

    Context-preserving variant of akka.stream.javadsl.Flow.logWithMarker.,

  35. def logWithMarker(name: String, marker: Function2[Out, Ctx, LogMarker], extract: Function[Out, Any], log: MarkerLoggingAdapter): SourceWithContext[Out, Ctx, Mat]

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

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

  37. def mapAsync[Out2](parallelism: Int, f: Function[Out, CompletionStage[Out2]]): SourceWithContext[Out2, Ctx, Mat]

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

  38. def mapAsyncPartitioned[Out2, P](parallelism: Int, perPartition: Int, partitioner: Function[Out, P], f: BiFunction[Out, P, CompletionStage[Out2]]): SourceWithContext[Out2, Ctx, Mat]

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

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

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

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

  41. def mapError(pf: PartialFunction[Throwable, Throwable]): SourceWithContext[Out, Ctx, Mat]

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

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

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

  43. def named(name: String): Graph[SourceShape[(Out, Ctx)], Mat]

    Specifies the name of the Graph.

    Specifies the name of the Graph. If the name is null or empty the name is ignored, i.e. #none is returned.

    Definition Classes
    Graph
  44. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  45. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @HotSpotIntrinsicCandidate() @native()
  46. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @HotSpotIntrinsicCandidate() @native()
  47. 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.

    Prefer the method taking an ActorSystem unless you have special requirements.

  48. def runWith[M](sink: Graph[SinkShape[Pair[Out, Ctx]], M], systemProvider: ClassicActorSystemProvider): 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.

  49. 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
  50. 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

  51. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  52. def throttle(cost: Int, per: Duration, maximumBurst: Int, costCalculation: Function[Out, Integer], mode: ThrottleMode): SourceWithContext[Out, Ctx, Mat]

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

  53. def throttle(cost: Int, per: Duration, costCalculation: Function[Out, Integer]): SourceWithContext[Out, Ctx, Mat]

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

  54. def throttle(elements: Int, per: Duration, maximumBurst: Int, mode: ThrottleMode): SourceWithContext[Out, Ctx, Mat]

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

  55. def throttle(elements: Int, per: Duration): SourceWithContext[Out, Ctx, Mat]

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

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

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

  58. def toString(): String
    Definition Classes
    AnyRef → Any
  59. def unsafeDataVia[Out2, Mat2](viaFlow: Graph[FlowShape[Out, Out2], Mat2]): SourceWithContext[Out2, Ctx, Mat]

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

    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

    akka.stream.javadsl.Flow.via

  61. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  62. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  63. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  64. def withAttributes(attr: Attributes): SourceWithContext[Out, Ctx, Mat]

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

Shadowed Implicit Value Members

  1. def mapMaterializedValue[M2](f: (Mat) => M2): Graph[SourceShape[(Out, Ctx)], M2]

    Transform the materialized value of this Graph, leaving all other properties as they were.

    Transform the materialized value of this Graph, leaving all other properties as they were.

    f

    function to map the graph's materialized value

    Implicit
    This member is added by an implicit conversion from SourceWithContext[Out, Ctx, Mat] toGraphMapMatVal[SourceShape[(Out, Ctx)], Mat] performed by method GraphMapMatVal in akka.stream.Graph.
    Shadowing
    This implicitly inherited member is shadowed by one or more members in this class.
    To access this member you can use a type ascription:
    (sourceWithContext: GraphMapMatVal[SourceShape[(Out, Ctx)], Mat]).mapMaterializedValue(f)
    Definition Classes
    GraphMapMatVal

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated
    Deprecated

    (Since version 9)

  2. def formatted(fmtstr: String): String
    Implicit
    This member is added by an implicit conversion from SourceWithContext[Out, Ctx, Mat] toStringFormat[SourceWithContext[Out, Ctx, Mat]] performed by method StringFormat in scala.Predef.
    Definition Classes
    StringFormat
    Annotations
    @deprecated @inline()
    Deprecated

    (Since version 2.12.16) Use formatString.format(value) instead of value.formatted(formatString), or use the f"" string interpolator. In Java 15 and later, formatted resolves to the new method in String which has reversed parameters.

  3. def [B](y: B): (SourceWithContext[Out, Ctx, Mat], B)
    Implicit
    This member is added by an implicit conversion from SourceWithContext[Out, Ctx, Mat] toArrowAssoc[SourceWithContext[Out, Ctx, Mat]] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc
    Annotations
    @deprecated
    Deprecated

    (Since version 2.13.0) Use -> instead. If you still wish to display it as one character, consider using a font with programming ligatures such as Fira Code.

Inherited from GraphDelegate[SourceShape[(Out, Ctx)], Mat]

Inherited from Graph[SourceShape[(Out, Ctx)], Mat]

Inherited from AnyRef

Inherited from Any

Inherited by implicit conversion GraphMapMatVal fromSourceWithContext[Out, Ctx, Mat] to GraphMapMatVal[SourceShape[(Out, Ctx)], Mat]

Inherited by implicit conversion any2stringadd fromSourceWithContext[Out, Ctx, Mat] to any2stringadd[SourceWithContext[Out, Ctx, Mat]]

Inherited by implicit conversion StringFormat fromSourceWithContext[Out, Ctx, Mat] to StringFormat[SourceWithContext[Out, Ctx, Mat]]

Inherited by implicit conversion Ensuring fromSourceWithContext[Out, Ctx, Mat] to Ensuring[SourceWithContext[Out, Ctx, Mat]]

Inherited by implicit conversion ArrowAssoc fromSourceWithContext[Out, Ctx, Mat] to ArrowAssoc[SourceWithContext[Out, Ctx, Mat]]

Ungrouped