final class SourceWithContext[+Out, +Ctx, +Mat] extends GraphDelegate[SourceShape[(Out, Ctx)], Mat] with FlowWithContextOps[Out, Ctx, 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.asSourceWithContext
- Source
- SourceWithContext.scala
- Alphabetic
- By Inheritance
- SourceWithContext
- FlowWithContextOps
- GraphDelegate
- Graph
- AnyRef
- Any
- by GraphMapMatVal
- by any2stringadd
- by StringFormat
- by Ensuring
- by ArrowAssoc
- Hide All
- Show All
- Public
- Protected
Type Members
- type Repr[+O, +C] = ReprMat[O, C, Mat]
- Definition Classes
- FlowWithContextOps
- type ReprMat[+O, +C, +M] = SourceWithContext[O, C, 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
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- 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
- 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()
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- 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
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def asJava[JOut >: Out, JCtx >: Ctx, JMat >: Mat]: javadsl.SourceWithContext[JOut, JCtx, JMat]
- def asSource: Source[(Out, Ctx), Mat]
Stops automatic context propagation from here and converts this to a regular stream of a pair of (data, context).
- 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 clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
- def collect[Out2](f: PartialFunction[Out, Out2]): Repr[Out2, Ctx]
Context-preserving variant of pekko.stream.scaladsl.FlowOps.collect.
Context-preserving variant of pekko.stream.scaladsl.FlowOps.collect.
Note, that the context of elements that are filtered out is skipped as well.
- Definition Classes
- FlowWithContextOps
- See also
- 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
- 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
- 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
- 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
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def filter(pred: (Out) => Boolean): Repr[Out, Ctx]
Context-preserving variant of pekko.stream.scaladsl.FlowOps.filter.
Context-preserving variant of pekko.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[Out, Ctx]
Context-preserving variant of pekko.stream.scaladsl.FlowOps.filterNot.
Context-preserving variant of pekko.stream.scaladsl.FlowOps.filterNot.
Note, that the context of elements that are filtered out is skipped as well.
- Definition Classes
- FlowWithContextOps
- See also
- def getAttributes: Attributes
- Definition Classes
- Graph
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def grouped(n: Int): Repr[Seq[Out], Seq[Ctx]]
Context-preserving variant of pekko.stream.scaladsl.FlowOps.grouped.
Context-preserving variant of pekko.stream.scaladsl.FlowOps.grouped.
Each output group will be associated with a
Seq
of corresponding context elements.- Definition Classes
- FlowWithContextOps
- See also
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def log(name: String, extract: (Out) => Any = ConstantFun.scalaIdentityFunction)(implicit log: LoggingAdapter = null): Repr[Out, Ctx]
Context-preserving variant of pekko.stream.scaladsl.FlowOps.log.
Context-preserving variant of pekko.stream.scaladsl.FlowOps.log.
- Definition Classes
- FlowWithContextOps
- See also
- def logWithMarker(name: String, marker: (Out, Ctx) => LogMarker, extract: (Out) => Any = ConstantFun.scalaIdentityFunction)(implicit log: MarkerLoggingAdapter = null): Repr[Out, Ctx]
Context-preserving variant of pekko.stream.scaladsl.FlowOps.logWithMarker.
Context-preserving variant of pekko.stream.scaladsl.FlowOps.logWithMarker.
- Definition Classes
- FlowWithContextOps
- See also
- def map[Out2](f: (Out) => Out2): Repr[Out2, Ctx]
Context-preserving variant of pekko.stream.scaladsl.FlowOps.map.
Context-preserving variant of pekko.stream.scaladsl.FlowOps.map.
- Definition Classes
- FlowWithContextOps
- See also
- def mapAsync[Out2](parallelism: Int)(f: (Out) => Future[Out2]): Repr[Out2, Ctx]
Context-preserving variant of pekko.stream.scaladsl.FlowOps.mapAsync.
Context-preserving variant of pekko.stream.scaladsl.FlowOps.mapAsync.
- Definition Classes
- FlowWithContextOps
- See also
- def mapConcat[Out2](f: (Out) => IterableOnce[Out2]): Repr[Out2, Ctx]
Context-preserving variant of pekko.stream.scaladsl.FlowOps.mapConcat.
Context-preserving variant of pekko.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[Out, Ctx2]
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 mapError(pf: PartialFunction[Throwable, Throwable]): Repr[Out, Ctx]
Context-preserving variant of pekko.stream.scaladsl.FlowOps.mapError.
Context-preserving variant of pekko.stream.scaladsl.FlowOps.mapError.
- Definition Classes
- FlowWithContextOps
- See also
- def mapMaterializedValue[Mat2](f: (Mat) => Mat2): SourceWithContext[Out, Ctx, Mat2]
Context-preserving variant of pekko.stream.scaladsl.Source.mapMaterializedValue.
Context-preserving variant of pekko.stream.scaladsl.Source.mapMaterializedValue.
- 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
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def runWith[Mat2](sink: Graph[SinkShape[(Out, Ctx)], Mat2])(implicit materializer: Materializer): Mat2
Connect this pekko.stream.scaladsl.SourceWithContext to a pekko.stream.scaladsl.Sink and run it.
Connect this pekko.stream.scaladsl.SourceWithContext to a pekko.stream.scaladsl.Sink and run it. The returned value is the materialized value of the
Sink
.Note that the
ActorSystem
can be used as the implicitmaterializer
parameter to use the pekko.stream.SystemMaterializer for running the stream. - 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[Out], Seq[Ctx]]
Context-preserving variant of pekko.stream.scaladsl.FlowOps.sliding.
Context-preserving variant of pekko.stream.scaladsl.FlowOps.sliding.
Each output group will be associated with a
Seq
of corresponding context elements.- Definition Classes
- FlowWithContextOps
- See also
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def throttle(cost: Int, per: FiniteDuration, maximumBurst: Int, costCalculation: (Out) => Int, mode: ThrottleMode): Repr[Out, Ctx]
Context-preserving variant of pekko.stream.scaladsl.FlowOps.throttle.
Context-preserving variant of pekko.stream.scaladsl.FlowOps.throttle.
- Definition Classes
- FlowWithContextOps
- See also
- def throttle(cost: Int, per: FiniteDuration, costCalculation: (Out) => Int): Repr[Out, Ctx]
Context-preserving variant of pekko.stream.scaladsl.FlowOps.throttle.
Context-preserving variant of pekko.stream.scaladsl.FlowOps.throttle.
- Definition Classes
- FlowWithContextOps
- See also
- def throttle(elements: Int, per: FiniteDuration, maximumBurst: Int, mode: ThrottleMode): Repr[Out, Ctx]
Context-preserving variant of pekko.stream.scaladsl.FlowOps.throttle.
Context-preserving variant of pekko.stream.scaladsl.FlowOps.throttle.
- Definition Classes
- FlowWithContextOps
- See also
- def throttle(elements: Int, per: FiniteDuration): Repr[Out, Ctx]
Context-preserving variant of pekko.stream.scaladsl.FlowOps.throttle.
Context-preserving variant of pekko.stream.scaladsl.FlowOps.throttle.
- Definition Classes
- FlowWithContextOps
- See also
- def to[Mat2](sink: Graph[SinkShape[(Out, Ctx)], Mat2]): RunnableGraph[Mat]
Connect this pekko.stream.scaladsl.SourceWithContext to a pekko.stream.scaladsl.Sink, concatenating the processing steps of both.
- def toMat[Mat2, Mat3](sink: Graph[SinkShape[(Out, Ctx)], Mat2])(combine: (Mat, Mat2) => Mat3): RunnableGraph[Mat3]
Connect this pekko.stream.scaladsl.SourceWithContext to a pekko.stream.scaladsl.Sink, concatenating the processing steps of both.
- def toString(): String
- Definition Classes
- AnyRef → Any
- def unsafeDataVia[Out2, Mat2](viaFlow: Graph[FlowShape[Out, Out2], Mat2]): Repr[Out2, Ctx]
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://pekko.apache.org/docs/pekko/current/stream/stream-context.html.
- Definition Classes
- SourceWithContext → FlowWithContextOps
- def via[Out2, Ctx2, Mat2](viaFlow: Graph[FlowShape[(Out, Ctx), (Out2, Ctx2)], Mat2]): Repr[Out2, Ctx2]
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://pekko.apache.org/docs/pekko/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.
- Definition Classes
- SourceWithContext → FlowWithContextOps
- See also
- def viaMat[Out2, Ctx2, Mat2, Mat3](flow: Graph[FlowShape[(Out, Ctx), (Out2, Ctx2)], Mat2])(combine: (Mat, Mat2) => Mat3): SourceWithContext[Out2, Ctx2, 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).
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://pekko.apache.org/docs/pekko/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.
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
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- def withAttributes(attr: Attributes): SourceWithContext[Out, Ctx, Mat]
Context-preserving variant of pekko.stream.scaladsl.Source.withAttributes.
Context-preserving variant of pekko.stream.scaladsl.Source.withAttributes.
- Definition Classes
- SourceWithContext → Graph
- See also
Shadowed Implicit Value Members
- 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 org.apache.pekko.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
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated @Deprecated
- Deprecated
- 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 ofvalue.formatted(formatString)
, or use thef""
string interpolator. In Java 15 and later,formatted
resolves to the new method in String which has reversed parameters.
- 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.