Class SourceWithContext$

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

public class SourceWithContext$ extends Object
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final SourceWithContext$
    Static reference to the singleton instance of this Scala object.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    <Out, CtxOut, Mat>
    SourceWithContext<Out,CtxOut,Mat>
    fromTuples(Source<scala.Tuple2<Out,CtxOut>,Mat> source)
    Creates a SourceWithContext from a regular source that operates on a tuple of (data, context) elements.
    <SOut, FOut, Ctx, SMat, FMat, Mat>
    SourceWithContext<scala.Option<FOut>,Ctx,Mat>
    unsafeOptionalDataVia(SourceWithContext<scala.Option<SOut>,Ctx,SMat> source, Flow<SOut,FOut,FMat> viaFlow, scala.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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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

    • fromTuples

      public <Out, CtxOut, Mat> SourceWithContext<Out,CtxOut,Mat> fromTuples(Source<scala.Tuple2<Out,CtxOut>,Mat> source)
      Creates a SourceWithContext from a regular source that operates on a tuple of (data, context) elements.
    • unsafeOptionalDataVia

      public <SOut, FOut, Ctx, SMat, FMat, Mat> SourceWithContext<scala.Option<FOut>,Ctx,Mat> unsafeOptionalDataVia(SourceWithContext<scala.Option<SOut>,Ctx,SMat> source, Flow<SOut,FOut,FMat> viaFlow, scala.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 Option which indicates whether the original source's element had viaFlow applied.
      Since:
      1.1.0