Class FlowWithContext<CtxIn,​In,​CtxOut,​Out,​Mat>

  • All Implemented Interfaces:
    Graph<FlowShape<scala.Tuple2<In,​CtxIn>,​scala.Tuple2<Out,​CtxOut>>,​Mat>, FlowWithContextOps<CtxOut,​Out,​Mat>

    public final class FlowWithContext<CtxIn,​In,​CtxOut,​Out,​Mat>
    extends GraphDelegate<FlowShape<scala.Tuple2<In,​CtxIn>,​scala.Tuple2<Out,​CtxOut>>,​Mat>
    implements FlowWithContextOps<CtxOut,​Out,​Mat>
    A flow 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.

    An "empty" flow can be created by calling FlowWithContext[Ctx, T].

    API MAY CHANGE

    • Constructor Detail

      • FlowWithContext

        public FlowWithContext​(Flow<scala.Tuple2<In,​CtxIn>,​scala.Tuple2<Out,​CtxOut>,​Mat> delegate)
    • Method Detail

      • apply

        public static <Ctx,​In> FlowWithContext<Ctx,​In,​Ctx,​In,​NotUsed> apply()
        Creates an "empty" FlowWithContext that passes elements through with their context unchanged.
        Returns:
        (undocumented)
      • from

        public static <CI,​I,​CO,​O,​M> FlowWithContext<CI,​I,​CO,​O,​M> from​(Flow<scala.Tuple2<I,​CI>,​scala.Tuple2<O,​CO>,​M> flow)
        Creates a FlowWithContext from a regular flow that operates on a pair of (data, context) elements.
        Parameters:
        flow - (undocumented)
        Returns:
        (undocumented)
      • named

        public static Graph<S,​M> named​(java.lang.String name)
      • async

        public static Graph<S,​M> async()
      • async

        public static Graph<S,​M> async​(java.lang.String dispatcher)
      • async

        public static Graph<S,​M> async​(java.lang.String dispatcher,
                                             int inputBufferSize)
      • addAttributes

        public static Graph<S,​M> addAttributes​(Attributes attr)
      • shape

        public static final S shape()
      • withAttributes

        public static final Graph<S,​Mat> withAttributes​(Attributes attr)
      • mapAsync

        public static <Out2> FlowWithContextOps mapAsync​(int parallelism,
                                                         scala.Function1<Out,​scala.concurrent.Future<Out2>> f)
      • collect

        public static <Out2> FlowWithContextOps collect​(scala.PartialFunction<Out,​Out2> f)
      • filter

        public static FlowWithContextOps filter​(scala.Function1<Out,​java.lang.Object> pred)
      • filterNot

        public static FlowWithContextOps filterNot​(scala.Function1<Out,​java.lang.Object> pred)
      • sliding$default$2

        public static int sliding$default$2()
      • mapConcat

        public static <Out2> FlowWithContextOps mapConcat​(scala.Function1<Out,​scala.collection.immutable.Iterable<Out2>> f)
      • statefulMapConcat

        public static <Out2> FlowWithContextOps statefulMapConcat​(scala.Function0<scala.Function1<Out,​scala.collection.immutable.Iterable<Out2>>> f)
      • mapContext

        public static <Ctx2> FlowWithContextOps mapContext​(scala.Function1<Ctx,​Ctx2> f)
      • flow

        public static <T,​C> Flow<scala.Tuple2<T,​C>,​scala.Tuple2<T,​C>,​NotUsed> flow()
      • via

        public <Ctx2,​Out2,​Mat2> FlowWithContext<CtxIn,​In,​Ctx2,​Out2,​Mat> via​(Graph<FlowShape<scala.Tuple2<Out,​CtxOut>,​scala.Tuple2<Out2,​Ctx2>>,​Mat2> viaFlow)
        Description copied from interface: FlowWithContextOps
        Transform this flow by the regular flow. The given flow must support manual context propagation by taking and producing tuples of (data, context).

        This can be used as an escape hatch for operations that are not (yet) provided with automatic context propagation here.

        Specified by:
        via in interface FlowWithContextOps<CtxIn,​In,​CtxOut>
        Parameters:
        viaFlow - (undocumented)
        Returns:
        (undocumented)
        See Also:
        akka.stream.scaladsl.FlowOps.via
      • viaMat

        public <Ctx2,​Out2,​Mat2,​Mat3> FlowWithContext<CtxIn,​In,​Ctx2,​Out2,​Mat3> viaMat​(Graph<FlowShape<scala.Tuple2<Out,​CtxOut>,​scala.Tuple2<Out2,​Ctx2>>,​Mat2> flow,
                                                                                                                               scala.Function2<Mat,​Mat2,​Mat3> combine)
        Description copied from interface: FlowWithContextOps
        Transform this flow by the regular flow. The given flow must support manual context propagation by taking and producing tuples of (data, context).

        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.

        Specified by:
        viaMat in interface FlowWithContextOps<CtxIn,​In,​CtxOut>
        Parameters:
        flow - (undocumented)
        combine - (undocumented)
        Returns:
        (undocumented)
        See Also:
        akka.stream.scaladsl.FlowOps.viaMat
      • asJava

        public <JCtxIn extends CtxIn,​JIn extends In,​JCtxOut,​JOut,​JMat> FlowWithContext<JCtxIn,​JIn,​JCtxOut,​JOut,​JMat> asJava()