Class SourceWithContext<Out,Ctx,Mat>
- java.lang.Object
- 
- akka.stream.GraphDelegate<SourceShape<scala.Tuple2<Out,Ctx>>,Mat>
- 
- akka.stream.javadsl.SourceWithContext<Out,Ctx,Mat>
 
 
- 
- All Implemented Interfaces:
- Graph<SourceShape<scala.Tuple2<Out,Ctx>>,Mat>
 
 public final class SourceWithContext<Out,Ctx,Mat> extends akka.stream.GraphDelegate<SourceShape<scala.Tuple2<Out,Ctx>>,Mat> A source that provides operations which automatically propagate the context of an element. Only a subset of common operations fromSourceis supported. As an escape hatch you can usevia(akka.stream.Graph<akka.stream.FlowShape<akka.japi.Pair<Out, Ctx>, akka.japi.Pair<Out2, Ctx2>>, Mat2>)to manually provide the context propagation for otherwise unsupported operations.Can be created by calling Source.asSourceWithContext
- 
- 
Nested Class Summary- 
Nested classes/interfaces inherited from interface akka.stream.GraphGraph.GraphMapMatVal<S extends Shape,M>
 
- 
 - 
Constructor SummaryConstructors Constructor Description SourceWithContext(SourceWithContext<Out,Ctx,Mat> delegate)
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description SourceWithContext<Out,Ctx,Mat>asScala()Source<Pair<Out,Ctx>,Mat>asSource()Stops automatic context propagation from here and converts this to a regular stream of a pair of (data, context).<Out2> SourceWithContext<Out2,Ctx,Mat>collect(scala.PartialFunction<Out,Out2> pf)Context-preserving variant ofakka.stream.javadsl.Source.collect.SourceWithContext<Out,Ctx,Mat>filter(Predicate<Out> p)Context-preserving variant ofakka.stream.javadsl.Source.filter.SourceWithContext<Out,Ctx,Mat>filterNot(Predicate<Out> p)Context-preserving variant ofakka.stream.javadsl.Source.filterNot.static <Out,CtxOut,Mat>
 SourceWithContext<Out,CtxOut,Mat>fromPairs(Source<Pair<Out,CtxOut>,Mat> under)Creates a SourceWithContext from a regular flow that operates onPairelements.SourceWithContext<java.util.List<Out>,java.util.List<Ctx>,Mat>grouped(int n)Context-preserving variant ofakka.stream.javadsl.Source.grouped.SourceWithContext<Out,Ctx,Mat>log(java.lang.String name)Context-preserving variant ofakka.stream.javadsl.Flow.log.SourceWithContext<Out,Ctx,Mat>log(java.lang.String name, LoggingAdapter log)Context-preserving variant ofakka.stream.javadsl.Flow.log.SourceWithContext<Out,Ctx,Mat>log(java.lang.String name, Function<Out,java.lang.Object> extract)Context-preserving variant ofakka.stream.javadsl.Flow.log.SourceWithContext<Out,Ctx,Mat>log(java.lang.String name, Function<Out,java.lang.Object> extract, LoggingAdapter log)Context-preserving variant ofakka.stream.javadsl.Source.log.SourceWithContext<Out,Ctx,Mat>logWithMarker(java.lang.String name, Function2<Out,Ctx,LogMarker> marker)Context-preserving variant ofakka.stream.javadsl.Flow.logWithMarker.SourceWithContext<Out,Ctx,Mat>logWithMarker(java.lang.String name, Function2<Out,Ctx,LogMarker> marker, MarkerLoggingAdapter log)Context-preserving variant ofakka.stream.javadsl.Flow.logWithMarker.SourceWithContext<Out,Ctx,Mat>logWithMarker(java.lang.String name, Function2<Out,Ctx,LogMarker> marker, Function<Out,java.lang.Object> extract)Context-preserving variant ofakka.stream.javadsl.Flow.logWithMarker.,SourceWithContext<Out,Ctx,Mat>logWithMarker(java.lang.String name, Function2<Out,Ctx,LogMarker> marker, Function<Out,java.lang.Object> extract, MarkerLoggingAdapter log)Context-preserving variant ofakka.stream.javadsl.Source.logWithMarker.<Out2> SourceWithContext<Out2,Ctx,Mat>map(Function<Out,Out2> f)Context-preserving variant ofakka.stream.javadsl.Source.map.<Out2> SourceWithContext<Out2,Ctx,Mat>mapAsync(int parallelism, Function<Out,java.util.concurrent.CompletionStage<Out2>> f)Context-preserving variant ofakka.stream.javadsl.Source.mapAsync.<Out2,P>
 SourceWithContext<Out2,Ctx,Mat>mapAsyncPartitioned(int parallelism, int perPartition, Function<Out,P> partitioner, java.util.function.BiFunction<Out,P,java.util.concurrent.CompletionStage<Out2>> f)Context-preserving variant ofakka.stream.javadsl.Source.mapAsyncPartitioned.<Out2> SourceWithContext<Out2,Ctx,Mat>mapConcat(Function<Out,? extends java.lang.Iterable<Out2>> f)Context-preserving variant ofakka.stream.javadsl.Source.mapConcat.<Ctx2> SourceWithContext<Out,Ctx2,Mat>mapContext(Function<Ctx,Ctx2> extractContext)Apply the given function to each context element (leaving the data elements unchanged).SourceWithContext<Out,Ctx,Mat>mapError(scala.PartialFunction<java.lang.Throwable,java.lang.Throwable> pf)Context-preserving variant ofakka.stream.javadsl.Source.mapError.<Mat2> SourceWithContext<Out,Ctx,Mat2>mapMaterializedValue(Function<Mat,Mat2> f)Context-preserving variant ofakka.stream.javadsl.Source.mapMaterializedValue.<M> MrunWith(Graph<SinkShape<Pair<Out,Ctx>>,M> sink, ClassicActorSystemProvider systemProvider)Connect thisSourceWithContextto aSinkand run it.<M> MrunWith(Graph<SinkShape<Pair<Out,Ctx>>,M> sink, Materializer materializer)Connect thisSourceWithContextto aSinkand run it.SourceWithContext<java.util.List<Out>,java.util.List<Ctx>,Mat>sliding(int n, int step)Context-preserving variant ofakka.stream.javadsl.Source.sliding.intsliding$default$2()SourceWithContext<Out,Ctx,Mat>throttle(int elements, java.time.Duration per)Context-preserving variant ofakka.stream.javadsl.Source.throttle.SourceWithContext<Out,Ctx,Mat>throttle(int cost, java.time.Duration per, int maximumBurst, Function<Out,java.lang.Integer> costCalculation, ThrottleMode mode)Context-preserving variant ofakka.stream.javadsl.Source.throttle.SourceWithContext<Out,Ctx,Mat>throttle(int elements, java.time.Duration per, int maximumBurst, ThrottleMode mode)Context-preserving variant ofakka.stream.javadsl.Source.throttle.SourceWithContext<Out,Ctx,Mat>throttle(int cost, java.time.Duration per, Function<Out,java.lang.Integer> costCalculation)Context-preserving variant ofakka.stream.javadsl.Source.throttle.<Mat2> RunnableGraph<Mat>to(Graph<SinkShape<Pair<Out,Ctx>>,Mat2> sink)Connect thisSourceWithContextto aSink, concatenating the processing steps of both.<Mat2,Mat3>
 RunnableGraph<Mat3>toMat(Graph<SinkShape<Pair<Out,Ctx>>,Mat2> sink, Function2<Mat,Mat2,Mat3> combine)Connect thisSourceWithContextto aSink, concatenating the processing steps of both.<Out2,Mat2>
 SourceWithContext<Out2,Ctx,Mat>unsafeDataVia(Graph<FlowShape<Out,Out2>,Mat2> viaFlow)Transform this flow by the regular flow.<Out2,Ctx2,Mat2>
 SourceWithContext<Out2,Ctx2,Mat>via(Graph<FlowShape<Pair<Out,Ctx>,Pair<Out2,Ctx2>>,Mat2> viaFlow)Transform this flow by the regular flow.SourceWithContext<Out,Ctx,Mat>withAttributes(Attributes attr)Context-preserving variant ofakka.stream.javadsl.Source.withAttributes.
 
- 
- 
- 
Constructor Detail- 
SourceWithContextpublic SourceWithContext(SourceWithContext<Out,Ctx,Mat> delegate) 
 
- 
 - 
Method Detail- 
fromPairspublic static <Out,CtxOut,Mat> SourceWithContext<Out,CtxOut,Mat> fromPairs(Source<Pair<Out,CtxOut>,Mat> under) Creates a SourceWithContext from a regular flow that operates onPairelements.
 - 
viapublic <Out2,Ctx2,Mat2> SourceWithContext<Out2,Ctx2,Mat> via(Graph<FlowShape<Pair<Out,Ctx>,Pair<Out2,Ctx2>>,Mat2> viaFlow) 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
 
 - 
unsafeDataViapublic <Out2,Mat2> SourceWithContext<Out2,Ctx,Mat> unsafeDataVia(Graph<FlowShape<Out,Out2>,Mat2> viaFlow) 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. 
 - 
withAttributespublic SourceWithContext<Out,Ctx,Mat> withAttributes(Attributes attr) Context-preserving variant ofakka.stream.javadsl.Source.withAttributes.- See Also:
- akka.stream.javadsl.Source.withAttributes
 
 - 
mapErrorpublic SourceWithContext<Out,Ctx,Mat> mapError(scala.PartialFunction<java.lang.Throwable,java.lang.Throwable> pf) Context-preserving variant ofakka.stream.javadsl.Source.mapError.- See Also:
- akka.stream.javadsl.Source.mapError
 
 - 
mapMaterializedValuepublic <Mat2> SourceWithContext<Out,Ctx,Mat2> mapMaterializedValue(Function<Mat,Mat2> f) Context-preserving variant ofakka.stream.javadsl.Source.mapMaterializedValue.- See Also:
- akka.stream.javadsl.Flow.mapMaterializedValue
 
 - 
asSourcepublic Source<Pair<Out,Ctx>,Mat> asSource() Stops automatic context propagation from here and converts this to a regular stream of a pair of (data, context).
 - 
collectpublic <Out2> SourceWithContext<Out2,Ctx,Mat> collect(scala.PartialFunction<Out,Out2> pf) Context-preserving variant ofakka.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
 
 - 
filterpublic SourceWithContext<Out,Ctx,Mat> filter(Predicate<Out> p) Context-preserving variant ofakka.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
 
 - 
filterNotpublic SourceWithContext<Out,Ctx,Mat> filterNot(Predicate<Out> p) Context-preserving variant ofakka.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
 
 - 
groupedpublic SourceWithContext<java.util.List<Out>,java.util.List<Ctx>,Mat> grouped(int n) Context-preserving variant ofakka.stream.javadsl.Source.grouped.Each output group will be associated with a Seqof corresponding context elements.- See Also:
- akka.stream.javadsl.Source.grouped
 
 - 
mappublic <Out2> SourceWithContext<Out2,Ctx,Mat> map(Function<Out,Out2> f) Context-preserving variant ofakka.stream.javadsl.Source.map.- See Also:
- akka.stream.javadsl.Source.map
 
 - 
mapAsyncpublic <Out2> SourceWithContext<Out2,Ctx,Mat> mapAsync(int parallelism, Function<Out,java.util.concurrent.CompletionStage<Out2>> f) Context-preserving variant ofakka.stream.javadsl.Source.mapAsync.- See Also:
- akka.stream.javadsl.Source.mapAsync
 
 - 
mapAsyncPartitionedpublic <Out2,P> SourceWithContext<Out2,Ctx,Mat> mapAsyncPartitioned(int parallelism, int perPartition, Function<Out,P> partitioner, java.util.function.BiFunction<Out,P,java.util.concurrent.CompletionStage<Out2>> f) Context-preserving variant ofakka.stream.javadsl.Source.mapAsyncPartitioned.- See Also:
- akka.stream.javadsl.Source.mapAsyncPartitioned
 
 - 
mapConcatpublic <Out2> SourceWithContext<Out2,Ctx,Mat> mapConcat(Function<Out,? extends java.lang.Iterable<Out2>> f) Context-preserving variant ofakka.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
 
 - 
mapContextpublic <Ctx2> SourceWithContext<Out,Ctx2,Mat> mapContext(Function<Ctx,Ctx2> extractContext) Apply the given function to each context element (leaving the data elements unchanged).
 - 
slidingpublic SourceWithContext<java.util.List<Out>,java.util.List<Ctx>,Mat> sliding(int n, int step) Context-preserving variant ofakka.stream.javadsl.Source.sliding.Each output group will be associated with a Seqof corresponding context elements.- See Also:
- akka.stream.javadsl.Source.sliding
 
 - 
sliding$default$2public int sliding$default$2() 
 - 
logpublic SourceWithContext<Out,Ctx,Mat> log(java.lang.String name, Function<Out,java.lang.Object> extract, LoggingAdapter log) Context-preserving variant ofakka.stream.javadsl.Source.log.- See Also:
- akka.stream.javadsl.Source.log
 
 - 
logpublic SourceWithContext<Out,Ctx,Mat> log(java.lang.String name, Function<Out,java.lang.Object> extract) Context-preserving variant ofakka.stream.javadsl.Flow.log.- See Also:
- akka.stream.javadsl.Flow.log
 
 - 
logpublic SourceWithContext<Out,Ctx,Mat> log(java.lang.String name, LoggingAdapter log) Context-preserving variant ofakka.stream.javadsl.Flow.log.- See Also:
- akka.stream.javadsl.Flow.log
 
 - 
logpublic SourceWithContext<Out,Ctx,Mat> log(java.lang.String name) Context-preserving variant ofakka.stream.javadsl.Flow.log.- See Also:
- akka.stream.javadsl.Flow.log
 
 - 
logWithMarkerpublic SourceWithContext<Out,Ctx,Mat> logWithMarker(java.lang.String name, Function2<Out,Ctx,LogMarker> marker, Function<Out,java.lang.Object> extract, MarkerLoggingAdapter log) Context-preserving variant ofakka.stream.javadsl.Source.logWithMarker.- See Also:
- akka.stream.javadsl.Source.logWithMarker
 
 - 
logWithMarkerpublic SourceWithContext<Out,Ctx,Mat> logWithMarker(java.lang.String name, Function2<Out,Ctx,LogMarker> marker, Function<Out,java.lang.Object> extract) Context-preserving variant ofakka.stream.javadsl.Flow.logWithMarker.,- See Also:
- akka.stream.javadsl.Flow.logWithMarker
 
 - 
logWithMarkerpublic SourceWithContext<Out,Ctx,Mat> logWithMarker(java.lang.String name, Function2<Out,Ctx,LogMarker> marker, MarkerLoggingAdapter log) Context-preserving variant ofakka.stream.javadsl.Flow.logWithMarker.- See Also:
- akka.stream.javadsl.Flow.logWithMarker
 
 - 
logWithMarkerpublic SourceWithContext<Out,Ctx,Mat> logWithMarker(java.lang.String name, Function2<Out,Ctx,LogMarker> marker) Context-preserving variant ofakka.stream.javadsl.Flow.logWithMarker.- See Also:
- akka.stream.javadsl.Flow.logWithMarker
 
 - 
throttlepublic SourceWithContext<Out,Ctx,Mat> throttle(int elements, java.time.Duration per) Context-preserving variant ofakka.stream.javadsl.Source.throttle.- See Also:
- akka.stream.javadsl.Source.throttle
 
 - 
throttlepublic SourceWithContext<Out,Ctx,Mat> throttle(int elements, java.time.Duration per, int maximumBurst, ThrottleMode mode) Context-preserving variant ofakka.stream.javadsl.Source.throttle.- See Also:
- akka.stream.javadsl.Source.throttle
 
 - 
throttlepublic SourceWithContext<Out,Ctx,Mat> throttle(int cost, java.time.Duration per, Function<Out,java.lang.Integer> costCalculation) Context-preserving variant ofakka.stream.javadsl.Source.throttle.- See Also:
- akka.stream.javadsl.Source.throttle
 
 - 
throttlepublic SourceWithContext<Out,Ctx,Mat> throttle(int cost, java.time.Duration per, int maximumBurst, Function<Out,java.lang.Integer> costCalculation, ThrottleMode mode) Context-preserving variant ofakka.stream.javadsl.Source.throttle.- See Also:
- akka.stream.javadsl.Source.throttle
 
 - 
topublic <Mat2> RunnableGraph<Mat> to(Graph<SinkShape<Pair<Out,Ctx>>,Mat2> sink) Connect thisSourceWithContextto aSink, concatenating the processing steps of both.
 - 
toMatpublic <Mat2,Mat3> RunnableGraph<Mat3> toMat(Graph<SinkShape<Pair<Out,Ctx>>,Mat2> sink, Function2<Mat,Mat2,Mat3> combine) Connect thisSourceWithContextto aSink, concatenating the processing steps of both.
 - 
runWithpublic <M> M runWith(Graph<SinkShape<Pair<Out,Ctx>>,M> sink, ClassicActorSystemProvider systemProvider) Connect thisSourceWithContextto aSinkand run it. The returned value is the materialized value of theSink.
 - 
runWithpublic <M> M runWith(Graph<SinkShape<Pair<Out,Ctx>>,M> sink, Materializer materializer) Connect thisSourceWithContextto aSinkand run it. The returned value is the materialized value of theSink.Prefer the method taking an ActorSystem unless you have special requirements. 
 - 
asScalapublic SourceWithContext<Out,Ctx,Mat> asScala() 
 
- 
 
-