Class SourceWithContext$

java.lang.Object
org.apache.pekko.stream.javadsl.SourceWithContext$

public class SourceWithContext$ extends Object
  • Field Details

    • MODULE$

      public static final SourceWithContext$ MODULE$
      Static reference to the singleton instance of this Scala object.
  • Constructor Details

    • SourceWithContext$

      public SourceWithContext$()
  • Method Details

    • fromPairs

      public <Out, CtxOut, Mat> SourceWithContext<Out,CtxOut,Mat> fromPairs(Source<Pair<Out,CtxOut>,Mat> under)
      Creates a SourceWithContext from a regular flow that operates on Pair<data, context> elements.
    • unsafeOptionalDataVia

      public <SOut, FOut, Ctx, SMat, FMat, Mat> SourceWithContext<Optional<FOut>,Ctx,Mat> unsafeOptionalDataVia(SourceWithContext<Optional<SOut>,Ctx,SMat> source, Flow<SOut,FOut,FMat> viaFlow, Function2<SMat,FMat,Mat> combine)
      Creates a SourceWithContext from an existing base SourceWithContext outputting an optional element and applying an additional viaFlow only if the element in the stream is defined.

      '''Emits when''' the provided viaFlow runs with defined elements

      '''Backpressures when''' the viaFlow runs for the defined elements and downstream backpressures

      '''Completes when''' upstream completes

      '''Cancels when''' downstream cancels

      Parameters:
      source - The base source that outputs an optional element
      viaFlow - The flow that gets used if the optional element in is defined. This flow only works on the data portion of flow and ignores the context so this flow *must* not re-order, drop or emit multiple elements for one incoming element
      combine - How to combine the materialized values of source and viaFlow
      Returns:
      a SourceWithContext with the viaFlow applied onto defined elements of the flow. The output value is contained within an Optional which indicates whether the original source's element had viaFlow applied.
      Since:
      1.1.0