Class Flow<In,Out,Mat>
- java.lang.Object
-
- akka.stream.scaladsl.Flow<In,Out,Mat>
-
- All Implemented Interfaces:
Graph<FlowShape<In,Out>,Mat>,FlowOps<Out,Mat>,FlowOpsMat<Out,Mat>
public final class Flow<In,Out,Mat> extends java.lang.Object implements FlowOpsMat<Out,Mat>, Graph<FlowShape<In,Out>,Mat>
Connect thisFlowto aSink, concatenating the processing steps of both.
The materialized value of the combined+------------------------------+ | Resulting Sink[In, Mat] | | | | +------+ +------+ | | | | | | | In ~~> | flow | ~~Out~~> | sink | | | | Mat| | M| | | +------+ +------+ | +------------------------------+Sinkwill be the materialized value of the current flow (ignoring the given Sink’s value), use {@link Flow#toMat[Mat2* toMat} if a different strategy is needed.See also
<Mat2,Mat3>toMat(akka.stream.Graph<akka.stream.SinkShape<Out>,Mat2>,scala.Function2<Mat,Mat2,Mat3>)when access to materialized values of the parameter is needed.
-
-
Constructor Summary
Constructors Constructor Description Flow(LinearTraversalBuilder traversalBuilder, FlowShape<In,Out> shape)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description Flow<In,Out,Mat>addAttributes(Attributes attr)Add the given attributes to thisFlow.static <T> Flow<T,T,NotUsed>apply()Returns aFlowwhich outputs all its inputs.<U,CtxU,CtxOut>
FlowWithContext<U,CtxU,Out,CtxOut,Mat>asFlowWithContext(scala.Function2<U,CtxU,In> collapseContext, scala.Function1<Out,CtxOut> extractContext)Turns a Flow into a FlowWithContext which manages a context per element along a stream.<JIn extends In>
Flow<JIn,Out,Mat>asJava()Converts this Scala DSL element to it's Java DSL counterpart.Flow<In,Out,Mat>async()Put an asynchronous boundary around thisFlowFlow<In,Out,Mat>async(java.lang.String dispatcher)Put an asynchronous boundary around thisFlowFlow<In,Out,Mat>async(java.lang.String dispatcher, int inputBufferSize)Put an asynchronous boundary around thisFlowstatic <A,B>
Flow<A,B,NotUsed>fromFunction(scala.Function1<A,B> f)Creates a [Flow] which will use the given function to transform its inputs to outputs.static <I,O,M>
Flow<I,O,M>fromGraph(Graph<FlowShape<I,O>,M> g)A graph with the shape of a flow logically is a flow, this method makes it so also in type.static <I,O>
Flow<I,O,NotUsed>fromProcessor(scala.Function0<org.reactivestreams.Processor<I,O>> processorFactory)Creates a Flow from a Reactive StreamsProcessorstatic <I,O,M>
Flow<I,O,M>fromProcessorMat(scala.Function0<scala.Tuple2<org.reactivestreams.Processor<I,O>,M>> processorFactory)Creates a Flow from a Reactive StreamsProcessorand returns a materialized value.static <I,O>
Flow<I,O,NotUsed>fromSinkAndSource(Graph<SinkShape<I>,?> sink, Graph<SourceShape<O>,?> source)Creates aFlowfrom aSinkand aSourcewhere the Flow's input will be sent to the Sink and the Flow's output will come from the Source.static <I,O>
Flow<I,O,NotUsed>fromSinkAndSourceCoupled(Graph<SinkShape<I>,?> sink, Graph<SourceShape<O>,?> source)Allows coupling termination (cancellation, completion, erroring) of Sinks and Sources while creating a Flow from them.static <I,O,M1,M2,M>
Flow<I,O,M>fromSinkAndSourceCoupledMat(Graph<SinkShape<I>,M1> sink, Graph<SourceShape<O>,M2> source, scala.Function2<M1,M2,M> combine)Allows coupling termination (cancellation, completion, erroring) of Sinks and Sources while creating a Flow from them.static <I,O,M1,M2,M>
Flow<I,O,M>fromSinkAndSourceMat(Graph<SinkShape<I>,M1> sink, Graph<SourceShape<O>,M2> source, scala.Function2<M1,M2,M> combine)Creates aFlowfrom aSinkand aSourcewhere the Flow's input will be sent to the Sink and the Flow's output will come from the Source.static LinearTraversalBuilderidentityTraversalBuilder()booleanisIdentity()<I2,O2,Mat2>
Flow<I2,O2,Mat>join(Graph<BidiShape<Out,O2,I2,In>,Mat2> bidi)<Mat2> RunnableGraph<Mat>join(Graph<FlowShape<Out,In>,Mat2> flow)Join thisFlowto anotherFlow, by cross connecting the inputs and outputs, creating aRunnableGraph.<I2,O2,Mat2,M>
Flow<I2,O2,M>joinMat(Graph<BidiShape<Out,O2,I2,In>,Mat2> bidi, scala.Function2<Mat,Mat2,M> combine)<Mat2,Mat3>
RunnableGraph<Mat3>joinMat(Graph<FlowShape<Out,In>,Mat2> flow, scala.Function2<Mat,Mat2,Mat3> combine)Join thisFlowto anotherFlow, by cross connecting the inputs and outputs, creating aRunnableGraphstatic <I,O,M>
Flow<I,O,M>lazyInit(scala.Function1<I,scala.concurrent.Future<Flow<I,O,M>>> flowFactory, scala.Function0<M> fallback)Deprecated.Use lazyInitAsync instead.static <I,O,M>
Flow<I,O,scala.concurrent.Future<scala.Option<M>>>lazyInitAsync(scala.Function0<scala.concurrent.Future<Flow<I,O,M>>> flowFactory)Creates a realFlowupon receiving the first element.<Mat2> Flow<In,Out,Mat2>mapMaterializedValue(scala.Function1<Mat,Mat2> f)Transform the materialized value of this Flow, leaving all other properties as they were.Flow<In,Out,Mat>named(java.lang.String name)Add anameattribute to this Flow.<Mat1,Mat2>
scala.Tuple2<Mat1,Mat2>runWith(Graph<SourceShape<In>,Mat1> source, Graph<SinkShape<Out>,Mat2> sink, Materializer materializer)Connect theSourceto thisFlowand then connect it to theSinkand run it.static <T,U,M>
Flow<T,U,scala.concurrent.Future<M>>setup(scala.Function2<ActorMaterializer,Attributes,Flow<T,U,M>> factory)Defers the creation of aFlowuntil materialization.FlowShape<In,Out>shape()The shape of a graph is all that is externally visible: its inlets and outlets.<Mat2> Sink<In,Mat>to(Graph<SinkShape<Out>,Mat2> sink)<Mat2,Mat3>
Sink<In,Mat3>toMat(Graph<SinkShape<Out>,Mat2> sink, scala.Function2<Mat,Mat2,Mat3> combine)RunnableGraph<org.reactivestreams.Processor<In,Out>>toProcessor()Converts this Flow to aRunnableGraphthat materializes to a Reactive StreamsProcessorwhich implements the operations encapsulated by this Flow.java.lang.StringtoString()LinearTraversalBuildertraversalBuilder()INTERNAL API.<T,Mat2>
Flow<In,T,Mat>via(Graph<FlowShape<Out,T>,Mat2> flow)<T,Mat2,Mat3>
Flow<In,T,Mat3>viaMat(Graph<FlowShape<Out,T>,Mat2> flow, scala.Function2<Mat,Mat2,Mat3> combine)Transform thisFlowby appending the given processing steps.Flow<In,Out,Mat>withAttributes(Attributes attr)Replace the attributes of thisFlowwith the given ones.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface akka.stream.scaladsl.FlowOps
$plus$plus, alsoTo, alsoToGraph, ask, ask, backpressureTimeout, batch, batchWeighted, buffer, collect, collectType, completionTimeout, concat, concatGraph, conflate, conflateWithSeed, delay, delay$default$2, detach, divertTo, divertToGraph, drop, dropWhile, dropWithin, expand, extrapolate, extrapolate$default$2, filter, filterNot, flatMapConcat, flatMapMerge, fold, foldAsync, groupBy, groupBy, grouped, groupedWeightedWithin, groupedWithin, idleTimeout, initialDelay, initialTimeout, interleave, interleave, interleaveGraph, interleaveGraph$default$3, intersperse, intersperse, keepAlive, limit, limitWeighted, log, log$default$2, log$default$3, map, mapAsync, mapAsyncUnordered, mapConcat, mapError, merge, merge$default$2, mergeGraph, mergeSorted, mergeSortedGraph, orElse, orElseGraph, prefixAndTail, prepend, prependGraph, recover, recoverWith, recoverWithRetries, reduce, scan, scanAsync, sliding, sliding$default$2, splitAfter, splitAfter, splitWhen, splitWhen, statefulMapConcat, take, takeWhile, takeWhile, takeWithin, throttle, throttle, throttle, throttle, throttleEven, throttleEven, watch, wireTap, wireTap, wireTapGraph, zip, zipGraph, zipLatest, zipLatestGraph, zipLatestWith, zipLatestWithGraph, zipWith, zipWithGraph, zipWithIndex
-
Methods inherited from interface akka.stream.scaladsl.FlowOpsMat
alsoToMat, concatMat, divertToMat, interleaveMat, interleaveMat, mergeMat, mergeMat$default$2, mergeSortedMat, monitor, monitor, monitorMat, orElseMat, prependMat, watchTermination, wireTapMat, zipLatestMat, zipLatestWithMat, zipMat, zipWithMat
-
-
-
-
Constructor Detail
-
Flow
public Flow(LinearTraversalBuilder traversalBuilder, FlowShape<In,Out> shape)
-
-
Method Detail
-
identityTraversalBuilder
public static LinearTraversalBuilder identityTraversalBuilder()
-
fromProcessor
public static <I,O> Flow<I,O,NotUsed> fromProcessor(scala.Function0<org.reactivestreams.Processor<I,O>> processorFactory)
Creates a Flow from a Reactive StreamsProcessor- Parameters:
processorFactory- (undocumented)- Returns:
- (undocumented)
-
fromProcessorMat
public static <I,O,M> Flow<I,O,M> fromProcessorMat(scala.Function0<scala.Tuple2<org.reactivestreams.Processor<I,O>,M>> processorFactory)
Creates a Flow from a Reactive StreamsProcessorand returns a materialized value.- Parameters:
processorFactory- (undocumented)- Returns:
- (undocumented)
-
apply
public static <T> Flow<T,T,NotUsed> apply()
Returns aFlowwhich outputs all its inputs.- Returns:
- (undocumented)
-
fromFunction
public static <A,B> Flow<A,B,NotUsed> fromFunction(scala.Function1<A,B> f)
Creates a [Flow] which will use the given function to transform its inputs to outputs. It is equivalent toFlow[T].map(f)- Parameters:
f- (undocumented)- Returns:
- (undocumented)
-
fromGraph
public static <I,O,M> Flow<I,O,M> fromGraph(Graph<FlowShape<I,O>,M> g)
A graph with the shape of a flow logically is a flow, this method makes it so also in type.- Parameters:
g- (undocumented)- Returns:
- (undocumented)
-
setup
public static <T,U,M> Flow<T,U,scala.concurrent.Future<M>> setup(scala.Function2<ActorMaterializer,Attributes,Flow<T,U,M>> factory)
Defers the creation of aFlowuntil materialization. Thefactoryfunction exposesActorMaterializerwhich is going to be used during materialization andAttributesof theFlowreturned by this method.- Parameters:
factory- (undocumented)- Returns:
- (undocumented)
-
fromSinkAndSource
public static <I,O> Flow<I,O,NotUsed> fromSinkAndSource(Graph<SinkShape<I>,?> sink, Graph<SourceShape<O>,?> source)
Creates aFlowfrom aSinkand aSourcewhere the Flow's input will be sent to the Sink and the Flow's output will come from the Source.The resulting flow can be visualized as:
+----------------------------------------------+ | Resulting Flow[I, O, NotUsed] | | | | +---------+ +-----------+ | | | | | | | I ~~> | Sink[I] | [no-connection!] | Source[O] | ~~> O | | | | | | | +---------+ +-----------+ | +----------------------------------------------+The completion of the Sink and Source sides of a Flow constructed using this method are independent. So if the Sink receives a completion signal, the Source side will remain unaware of that. If you are looking to couple the termination signals of the two sides use
Flow.fromSinkAndSourceCoupledinstead.See also
<I,O,M1,M2,M>fromSinkAndSourceMat(akka.stream.Graph<akka.stream.SinkShape<I>,M1>,akka.stream.Graph<akka.stream.SourceShape<O>,M2>,scala.Function2<M1,M2,M>)when access to materialized values of the parameters is needed.- Parameters:
sink- (undocumented)source- (undocumented)- Returns:
- (undocumented)
-
fromSinkAndSourceMat
public static <I,O,M1,M2,M> Flow<I,O,M> fromSinkAndSourceMat(Graph<SinkShape<I>,M1> sink, Graph<SourceShape<O>,M2> source, scala.Function2<M1,M2,M> combine)
Creates aFlowfrom aSinkand aSourcewhere the Flow's input will be sent to the Sink and the Flow's output will come from the Source.The resulting flow can be visualized as:
+-------------------------------------------------------+ | Resulting Flow[I, O, M] | | | | +-------------+ +---------------+ | | | | | | | I ~~> | Sink[I, M1] | [no-connection!] | Source[O, M2] | ~~> O | | | | | | | +-------------+ +---------------+ | +------------------------------------------------------+The completion of the Sink and Source sides of a Flow constructed using this method are independent. So if the Sink receives a completion signal, the Source side will remain unaware of that. If you are looking to couple the termination signals of the two sides use
Flow.fromSinkAndSourceCoupledMatinstead.The
combinefunction is used to compose the materialized values of thesinkandsourceinto the materialized value of the resultingFlow.- Parameters:
sink- (undocumented)source- (undocumented)combine- (undocumented)- Returns:
- (undocumented)
-
fromSinkAndSourceCoupled
public static <I,O> Flow<I,O,NotUsed> fromSinkAndSourceCoupled(Graph<SinkShape<I>,?> sink, Graph<SourceShape<O>,?> source)
Allows coupling termination (cancellation, completion, erroring) of Sinks and Sources while creating a Flow from them. Similar toFlow.fromSinkAndSourcehowever couples the termination of these two operators.The resulting flow can be visualized as:
+---------------------------------------------+ | Resulting Flow[I, O, NotUsed] | | | | +---------+ +-----------+ | | | | | | | I ~~> | Sink[I] | ~~~(coupled)~~~ | Source[O] | ~~> O | | | | | | | +---------+ +-----------+ | +---------------------------------------------+E.g. if the emitted
Flowgets a cancellation, theSourceof course is cancelled, however the Sink will also be completed. The table below illustrates the effects in detail:Returned Flow Sink ( in)Source ( out)cause: upstream (sink-side) receives completion effect: receives completion effect: receives cancel cause: upstream (sink-side) receives error effect: receives error effect: receives cancel cause: downstream (source-side) receives cancel effect: completes effect: receives cancel effect: cancels upstream, completes downstream effect: completes cause: signals complete effect: cancels upstream, errors downstream effect: receives error cause: signals error or throws effect: cancels upstream, completes downstream cause: cancels effect: receives cancel See also
<I,O,M1,M2,M>fromSinkAndSourceCoupledMat(akka.stream.Graph<akka.stream.SinkShape<I>,M1>,akka.stream.Graph<akka.stream.SourceShape<O>,M2>,scala.Function2<M1,M2,M>)when access to materialized values of the parameters is needed.- Parameters:
sink- (undocumented)source- (undocumented)- Returns:
- (undocumented)
-
fromSinkAndSourceCoupledMat
public static <I,O,M1,M2,M> Flow<I,O,M> fromSinkAndSourceCoupledMat(Graph<SinkShape<I>,M1> sink, Graph<SourceShape<O>,M2> source, scala.Function2<M1,M2,M> combine)
Allows coupling termination (cancellation, completion, erroring) of Sinks and Sources while creating a Flow from them. Similar toFlow.fromSinkAndSourcehowever couples the termination of these two operators.The resulting flow can be visualized as:
+-----------------------------------------------------+ | Resulting Flow[I, O, M] | | | | +-------------+ +---------------+ | | | | | | | I ~~> | Sink[I, M1] | ~~~(coupled)~~~ | Source[O, M2] | ~~> O | | | | | | | +-------------+ +---------------+ | +-----------------------------------------------------+E.g. if the emitted
Flowgets a cancellation, theSourceof course is cancelled, however the Sink will also be completed. The table onFlow.fromSinkAndSourceCoupledillustrates the effects in detail.The
combinefunction is used to compose the materialized values of thesinkandsourceinto the materialized value of the resultingFlow.- Parameters:
sink- (undocumented)source- (undocumented)combine- (undocumented)- Returns:
- (undocumented)
-
lazyInit
public static <I,O,M> Flow<I,O,M> lazyInit(scala.Function1<I,scala.concurrent.Future<Flow<I,O,M>>> flowFactory, scala.Function0<M> fallback)
Deprecated.Use lazyInitAsync instead. (lazyInitAsync returns a flow with a more useful materialized value.). Since 2.5.12.Creates a realFlowupon receiving the first element. InternalFlowwill not be created if there are no elements, because of completion, cancellation, or error.The materialized value of the
Flowis the value that is created by thefallbackfunction.'''Emits when''' the internal flow is successfully created and it emits
'''Backpressures when''' the internal flow is successfully created and it backpressures
'''Completes when''' upstream completes and all elements have been emitted from the internal flow
'''Cancels when''' downstream cancels
- Parameters:
flowFactory- (undocumented)fallback- (undocumented)- Returns:
- (undocumented)
-
lazyInitAsync
public static <I,O,M> Flow<I,O,scala.concurrent.Future<scala.Option<M>>> lazyInitAsync(scala.Function0<scala.concurrent.Future<Flow<I,O,M>>> flowFactory)
Creates a realFlowupon receiving the first element. InternalFlowwill not be created if there are no elements, because of completion, cancellation, or error.The materialized value of the
Flowis aFuture[Option[M}that is completed withSome(mat)when the internal flow gets materialized or withNonewhen there where no elements. If the flow materialization (including the call of theflowFactory) fails then the future is completed with a failure.'''Emits when''' the internal flow is successfully created and it emits
'''Backpressures when''' the internal flow is successfully created and it backpressures
'''Completes when''' upstream completes and all elements have been emitted from the internal flow
'''Cancels when''' downstream cancels
- Parameters:
flowFactory- (undocumented)- Returns:
- (undocumented)
-
traversalBuilder
public LinearTraversalBuilder traversalBuilder()
Description copied from interface:GraphINTERNAL API.Every materializable element must be backed by a stream layout module
- Specified by:
traversalBuilderin interfaceGraph<In,Out>- Returns:
- (undocumented)
-
shape
public FlowShape<In,Out> shape()
Description copied from interface:GraphThe shape of a graph is all that is externally visible: its inlets and outlets.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
isIdentity
public boolean isIdentity()
-
viaMat
public <T,Mat2,Mat3> Flow<In,T,Mat3> viaMat(Graph<FlowShape<Out,T>,Mat2> flow, scala.Function2<Mat,Mat2,Mat3> combine)
Description copied from interface:FlowOpsMatTransform thisFlowby appending the given processing steps.
The+---------------------------------+ | Resulting Flow[In, T, M2] | | | | +------+ +------+ | | | | | | | In ~~> | this | ~~Out~~> | flow | ~~> T | | Mat| | M| | | +------+ +------+ | +---------------------------------+combinefunction is used to compose the materialized values of this flow and that flow into the materialized value of the resulting Flow.It is recommended to use the internally optimized
Keep.leftandKeep.rightcombiners where appropriate instead of manually writing functions that pass through one of the values.- Specified by:
viaMatin interfaceFlowOpsMat<In,Out>- Parameters:
flow- (undocumented)combine- (undocumented)- Returns:
- (undocumented)
-
to
public <Mat2> Sink<In,Mat> to(Graph<SinkShape<Out>,Mat2> sink)
Connect thisFlowto aSink, concatenating the processing steps of both.
The materialized value of the combined+------------------------------+ | Resulting Sink[In, Mat] | | | | +------+ +------+ | | | | | | | In ~~> | flow | ~~Out~~> | sink | | | | Mat| | M| | | +------+ +------+ | +------------------------------+Sinkwill be the materialized value of the current flow (ignoring the given Sink’s value), use {@link Flow#toMat[Mat2* toMat} if a different strategy is needed.See also
<Mat2,Mat3>toMat(akka.stream.Graph<akka.stream.SinkShape<Out>,Mat2>,scala.Function2<Mat,Mat2,Mat3>)when access to materialized values of the parameter is needed.
-
toMat
public <Mat2,Mat3> Sink<In,Mat3> toMat(Graph<SinkShape<Out>,Mat2> sink, scala.Function2<Mat,Mat2,Mat3> combine)
Connect thisFlowto aSink, concatenating the processing steps of both.
The+----------------------------+ | Resulting Sink[In, M2] | | | | +------+ +------+ | | | | | | | In ~~> | flow | ~Out~> | sink | | | | Mat| | M| | | +------+ +------+ | +----------------------------+combinefunction is used to compose the materialized values of this flow and that Sink into the materialized value of the resulting Sink.It is recommended to use the internally optimized
Keep.leftandKeep.rightcombiners where appropriate instead of manually writing functions that pass through one of the values.- Specified by:
toMatin interfaceFlowOpsMat<In,Out>- Parameters:
sink- (undocumented)combine- (undocumented)- Returns:
- (undocumented)
-
mapMaterializedValue
public <Mat2> Flow<In,Out,Mat2> mapMaterializedValue(scala.Function1<Mat,Mat2> f)
Transform the materialized value of this Flow, leaving all other properties as they were.- Specified by:
mapMaterializedValuein interfaceFlowOpsMat<In,Out>- Parameters:
f- (undocumented)- Returns:
- (undocumented)
-
join
public <Mat2> RunnableGraph<Mat> join(Graph<FlowShape<Out,In>,Mat2> flow)
Join thisFlowto anotherFlow, by cross connecting the inputs and outputs, creating aRunnableGraph.
The materialized value of the combined+------+ +-------+ | | ~Out~> | | | this | | other | | | <~In~ | | +------+ +-------+Flowwill be the materialized value of the current flow (ignoring the other Flow’s value), use {@link Flow#joinMat[Mat2* joinMat} if a different strategy is needed.- Parameters:
flow- (undocumented)- Returns:
- (undocumented)
-
joinMat
public <Mat2,Mat3> RunnableGraph<Mat3> joinMat(Graph<FlowShape<Out,In>,Mat2> flow, scala.Function2<Mat,Mat2,Mat3> combine)
Join thisFlowto anotherFlow, by cross connecting the inputs and outputs, creating aRunnableGraph
The+------+ +-------+ | | ~Out~> | | | this | | other | | | <~In~ | | +------+ +-------+combinefunction is used to compose the materialized values of this flow and that Flow into the materialized value of the resulting Flow.It is recommended to use the internally optimized
Keep.leftandKeep.rightcombiners where appropriate instead of manually writing functions that pass through one of the values.- Parameters:
flow- (undocumented)combine- (undocumented)- Returns:
- (undocumented)
-
join
public <I2,O2,Mat2> Flow<I2,O2,Mat> join(Graph<BidiShape<Out,O2,I2,In>,Mat2> bidi)
Join thisFlowto aBidiFlowto close off the “top” of the protocol stack:
The materialized value of the combined+---------------------------+ | Resulting Flow | | | | +------+ +------+ | | | | ~Out~> | | ~~> O2 | | flow | | bidi | | | | | <~In~ | | <~~ I2 | +------+ +------+ | +---------------------------+Flowwill be the materialized value of the current flow (ignoring theBidiFlow’s value), use {@link Flow#joinMat[I2* joinMat} if a different strategy is needed.- Parameters:
bidi- (undocumented)- Returns:
- (undocumented)
-
joinMat
public <I2,O2,Mat2,M> Flow<I2,O2,M> joinMat(Graph<BidiShape<Out,O2,I2,In>,Mat2> bidi, scala.Function2<Mat,Mat2,M> combine)
Join thisFlowto aBidiFlowto close off the “top” of the protocol stack:
The+---------------------------+ | Resulting Flow | | | | +------+ +------+ | | | | ~Out~> | | ~~> O2 | | flow | | bidi | | | | | <~In~ | | <~~ I2 | +------+ +------+ | +---------------------------+combinefunction is used to compose the materialized values of this flow and thatBidiFlowinto the materialized value of the resultingFlow.It is recommended to use the internally optimized
Keep.leftandKeep.rightcombiners where appropriate instead of manually writing functions that pass through one of the values.- Parameters:
bidi- (undocumented)combine- (undocumented)- Returns:
- (undocumented)
-
withAttributes
public Flow<In,Out,Mat> withAttributes(Attributes attr)
Replace the attributes of thisFlowwith the given ones. If this Flow is a composite of multiple graphs, new attributes on the composite will be less specific than attributes set directly on the individual graphs of the composite.Note that this operation has no effect on an empty Flow (because the attributes apply only to the contained processing operators).
- Specified by:
withAttributesin interfaceFlowOps<In,Out>- Specified by:
withAttributesin interfaceGraph<In,Out>- Parameters:
attr- (undocumented)- Returns:
- (undocumented)
-
addAttributes
public Flow<In,Out,Mat> addAttributes(Attributes attr)
Add the given attributes to thisFlow. If the specific attribute was already present on this graph this means the added attribute will be more specific than the existing one. If this Flow is a composite of multiple graphs, new attributes on the composite will be less specific than attributes set directly on the individual graphs of the composite.- Specified by:
addAttributesin interfaceFlowOps<In,Out>- Specified by:
addAttributesin interfaceGraph<In,Out>- Parameters:
attr- (undocumented)- Returns:
- (undocumented)
-
async
public Flow<In,Out,Mat> async(java.lang.String dispatcher)
Put an asynchronous boundary around thisFlow
-
async
public Flow<In,Out,Mat> async(java.lang.String dispatcher, int inputBufferSize)
Put an asynchronous boundary around thisFlow
-
runWith
public <Mat1,Mat2> scala.Tuple2<Mat1,Mat2> runWith(Graph<SourceShape<In>,Mat1> source, Graph<SinkShape<Out>,Mat2> sink, Materializer materializer)
Connect theSourceto thisFlowand then connect it to theSinkand run it. The returned tuple contains the materialized values of theSourceandSink, e.g. theSubscriberof a of aSource#subscriberand andPublisherof aSink#publisher.- Parameters:
source- (undocumented)sink- (undocumented)materializer- (undocumented)- Returns:
- (undocumented)
-
toProcessor
public RunnableGraph<org.reactivestreams.Processor<In,Out>> toProcessor()
Converts this Flow to aRunnableGraphthat materializes to a Reactive StreamsProcessorwhich implements the operations encapsulated by this Flow. Every materialization results in a new Processor instance, i.e. the returnedRunnableGraphis reusable.- Returns:
- A
RunnableGraphthat materializes to a Processor when run() is called on it.
-
asFlowWithContext
public <U,CtxU,CtxOut> FlowWithContext<U,CtxU,Out,CtxOut,Mat> asFlowWithContext(scala.Function2<U,CtxU,In> collapseContext, scala.Function1<Out,CtxOut> extractContext)
Turns a Flow into a FlowWithContext which manages a context per element along a stream.- Parameters:
collapseContext- turn each incoming pair of element and context value into an element of this FlowextractContext- turn each outgoing element of this Flow into an outgoing context valueAPI MAY CHANGE
- Returns:
- (undocumented)
-
-