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

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

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

    See Also:
    akka.stream.javadsl.Flow.via
    • Method Detail

      • fromPairs

        public static <In,​CtxIn,​Out,​CtxOut,​Mat> FlowWithContext<In,​CtxIn,​Out,​CtxOut,​Mat> fromPairs​(Flow<Pair<In,​CtxIn>,​Pair<Out,​CtxOut>,​Mat> under)
        Creates a FlowWithContext from a regular flow that operates on Pair elements.
        Parameters:
        under - (undocumented)
        Returns:
        (undocumented)
      • withAttributes

        public FlowWithContext<In,​CtxIn,​Out,​CtxOut,​Mat> withAttributes​(Attributes attr)
        Context-preserving variant of akka.stream.javadsl.Flow.withAttributes.

        Parameters:
        attr - (undocumented)
        Returns:
        (undocumented)
        See Also:
        akka.stream.javadsl.Flow.withAttributes
      • collect

        public <Out2> FlowWithContext<In,​CtxIn,​Out2,​CtxOut,​Mat> collect​(scala.PartialFunction<Out,​Out2> pf)
        Context-preserving variant of akka.stream.javadsl.Flow.collect.

        Note, that the context of elements that are filtered out is skipped as well.

        Parameters:
        pf - (undocumented)
        Returns:
        (undocumented)
        See Also:
        akka.stream.javadsl.Flow.collect
      • filter

        public FlowWithContext<In,​CtxIn,​Out,​CtxOut,​Mat> filter​(Predicate<Out> p)
        Context-preserving variant of akka.stream.javadsl.Flow.filter.

        Note, that the context of elements that are filtered out is skipped as well.

        Parameters:
        p - (undocumented)
        Returns:
        (undocumented)
        See Also:
        akka.stream.javadsl.Flow.filter
      • filterNot

        public FlowWithContext<In,​CtxIn,​Out,​CtxOut,​Mat> filterNot​(Predicate<Out> p)
        Context-preserving variant of akka.stream.javadsl.Flow.filterNot.

        Note, that the context of elements that are filtered out is skipped as well.

        Parameters:
        p - (undocumented)
        Returns:
        (undocumented)
        See Also:
        akka.stream.javadsl.Flow.filterNot
      • grouped

        public FlowWithContext<In,​CtxIn,​java.util.List<Out>,​java.util.List<CtxOut>,​Mat> grouped​(int n)
        Context-preserving variant of akka.stream.javadsl.Flow.grouped.

        Each output group will be associated with a Seq of corresponding context elements.

        Parameters:
        n - (undocumented)
        Returns:
        (undocumented)
        See Also:
        akka.stream.javadsl.Flow.grouped
      • map

        public <Out2> FlowWithContext<In,​CtxIn,​Out2,​CtxOut,​Mat> map​(Function<Out,​Out2> f)
        Context-preserving variant of akka.stream.javadsl.Flow.map.

        Parameters:
        f - (undocumented)
        Returns:
        (undocumented)
        See Also:
        akka.stream.javadsl.Flow.map
      • mapConcat

        public <Out2> FlowWithContext<In,​CtxIn,​Out2,​CtxOut,​Mat> mapConcat​(Function<Out,​? extends java.lang.Iterable<Out2>> f)
        Context-preserving variant of akka.stream.javadsl.Flow.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)

        Parameters:
        f - (undocumented)
        Returns:
        (undocumented)
        See Also:
        akka.stream.javadsl.Flow.mapConcat
      • mapContext

        public <CtxOut2> FlowWithContext<In,​CtxIn,​Out,​CtxOut2,​Mat> mapContext​(Function<CtxOut,​CtxOut2> extractContext)
        Apply the given function to each context element (leaving the data elements unchanged).
        Parameters:
        extractContext - (undocumented)
        Returns:
        (undocumented)
      • sliding

        public FlowWithContext<In,​CtxIn,​java.util.List<Out>,​java.util.List<CtxOut>,​Mat> sliding​(int n,
                                                                                                                        int step)
        Context-preserving variant of akka.stream.javadsl.Flow.sliding.

        Each output group will be associated with a Seq of corresponding context elements.

        Parameters:
        n - (undocumented)
        step - (undocumented)
        Returns:
        (undocumented)
        See Also:
        akka.stream.javadsl.Flow.sliding
      • sliding$default$2

        public int sliding$default$2()
      • log

        public FlowWithContext<In,​CtxIn,​Out,​CtxOut,​Mat> log​(java.lang.String name,
                                                                                    Function<Out,​java.lang.Object> extract,
                                                                                    LoggingAdapter log)
        Context-preserving variant of akka.stream.javadsl.Flow.log.

        Parameters:
        name - (undocumented)
        extract - (undocumented)
        log - (undocumented)
        Returns:
        (undocumented)
        See Also:
        akka.stream.javadsl.Flow.log
      • log

        public FlowWithContext<In,​CtxIn,​Out,​CtxOut,​Mat> log​(java.lang.String name,
                                                                                    Function<Out,​java.lang.Object> extract)
        Context-preserving variant of akka.stream.javadsl.Flow.log.

        Parameters:
        name - (undocumented)
        extract - (undocumented)
        Returns:
        (undocumented)
        See Also:
        akka.stream.javadsl.Flow.log
      • log

        public FlowWithContext<In,​CtxIn,​Out,​CtxOut,​Mat> log​(java.lang.String name,
                                                                                    LoggingAdapter log)
        Context-preserving variant of akka.stream.javadsl.Flow.log.

        Parameters:
        name - (undocumented)
        log - (undocumented)
        Returns:
        (undocumented)
        See Also:
        akka.stream.javadsl.Flow.log
      • log

        public FlowWithContext<In,​CtxIn,​Out,​CtxOut,​Mat> log​(java.lang.String name)
        Context-preserving variant of akka.stream.javadsl.Flow.log.

        Parameters:
        name - (undocumented)
        Returns:
        (undocumented)
        See Also:
        akka.stream.javadsl.Flow.log