Attributes
- Companion
- class
- Source
- Sink.scala
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
Sink.type
Members list
Value members
Concrete methods
INTERNAL API
INTERNAL API
Sends the elements of the stream to the given ActorRef. If the target actor terminates the stream will be canceled. When the stream is completed successfully the given onCompleteMessage will be sent to the destination actor. When the stream is completed with failure the onFailureMessage will be invoked and its result will be sent to the destination actor.
It will request at most maxInputBufferSize number of elements from upstream, but there is no back-pressure signal from the destination actor, i.e. if the actor is not consuming the messages fast enough the mailbox of the actor will grow. For potentially slow consumer actors it is recommended to use a bounded mailbox with zero mailbox-push-timeout-time or use a rate limiting operator in front of this Sink.
Attributes
- Source
- Sink.scala
Sends the elements of the stream to the given ActorRef that sends back back-pressure signal. First element is always onInitMessage, then stream is waiting for acknowledgement message ackMessage from the given actor which means that it is ready to process elements. It also requires ackMessage message after each stream element to make backpressure work.
Sends the elements of the stream to the given ActorRef that sends back back-pressure signal. First element is always onInitMessage, then stream is waiting for acknowledgement message ackMessage from the given actor which means that it is ready to process elements. It also requires ackMessage message after each stream element to make backpressure work.
If the target actor terminates the stream will be canceled. When the stream is completed successfully the given onCompleteMessage will be sent to the destination actor. When the stream is completed with failure - result of onFailureMessage(throwable) function will be sent to the destination actor.
Attributes
- Source
- Sink.scala
Sends the elements of the stream to the given ActorRef that sends back back-pressure signal. First element is always onInitMessage, then stream is waiting for acknowledgement message from the given actor which means that it is ready to process elements. It also requires an ack message after each stream element to make backpressure work. This variant will consider any message as ack message.
Sends the elements of the stream to the given ActorRef that sends back back-pressure signal. First element is always onInitMessage, then stream is waiting for acknowledgement message from the given actor which means that it is ready to process elements. It also requires an ack message after each stream element to make backpressure work. This variant will consider any message as ack message.
If the target actor terminates the stream will be canceled. When the stream is completed successfully the given onCompleteMessage will be sent to the destination actor. When the stream is completed with failure - result of onFailureMessage(throwable) function will be sent to the destination actor.
Attributes
- Source
- Sink.scala
A Sink that materializes into a org.reactivestreams.Publisher.
A Sink that materializes into a org.reactivestreams.Publisher.
If fanout is true, the materialized Publisher will support multiple Subscribers and the size of the inputBuffer configured for this operator becomes the maximum number of elements that the fastest org.reactivestreams.Subscriber can be ahead of the slowest one before slowing the processing down due to back pressure.
If fanout is false then the materialized Publisher will only support a single Subscriber and reject any additional Subscribers.
Attributes
- Source
- Sink.scala
A Sink that immediately cancels its upstream after materialization.
A Sink that keeps on collecting incoming elements until upstream terminates. As upstream may be unbounded, Flow[T].take or the stricter Flow[T].limit (and their variants) may be used to ensure boundedness. Materializes into a Future of That[T] containing all the collected elements. That[T] is limited to the limitations of the CanBuildFrom associated with it. For example, Seq is limited to Int.MaxValue elements. See The Architecture of Scala 2.13's Collections for more info. This Sink will cancel the stream after having received that many elements.
A Sink that keeps on collecting incoming elements until upstream terminates. As upstream may be unbounded, Flow[T].take or the stricter Flow[T].limit (and their variants) may be used to ensure boundedness. Materializes into a Future of That[T] containing all the collected elements. That[T] is limited to the limitations of the CanBuildFrom associated with it. For example, Seq is limited to Int.MaxValue elements. See The Architecture of Scala 2.13's Collections for more info. This Sink will cancel the stream after having received that many elements.
See also Flow.limit, Flow.limitWeighted, Flow.take, Flow.takeWithin, Flow.takeWhile
Attributes
- Source
- Sink.scala
Combine several sinks with fan-out strategy like Broadcast or Balance and returns Sink.
Combine several sinks with fan-out strategy like Broadcast or Balance and returns Sink.
Attributes
- Source
- Sink.scala
Combine several sinks with fan-out strategy like Broadcast or Balance and returns Sink. The fanoutGraph's outlets size must match the provides sinks'.
Combine several sinks with fan-out strategy like Broadcast or Balance and returns Sink. The fanoutGraph's outlets size must match the provides sinks'.
Attributes
- Since
-
1.1.0
- Source
- Sink.scala
Combine two sinks with fan-out strategy like Broadcast or Balance and returns Sink with 2 outlets.
Combine two sinks with fan-out strategy like Broadcast or Balance and returns Sink with 2 outlets.
Attributes
- Since
-
1.1.0
- Source
- Sink.scala
A Sink that will test the given predicate p for every received element and
A Sink that will test the given predicate p for every received element and
- completes and returns scala.concurrent.Future of
trueif the predicate is true for any element; - completes and returns scala.concurrent.Future of
falseif the stream is empty (i.e. completes before signalling any elements); - completes and returns scala.concurrent.Future of
falseif the predicate is false for all elements.
The materialized value scala.concurrent.Future will be completed with the value true or false when the input stream ends, or completed with Failure if there is a failure signaled in the stream.
Adheres to the ActorAttributes.SupervisionStrategy attribute.
'''Completes when''' upstream completes or the predicate p returns true
'''Backpressures when''' the invocation of predicate p has not yet completed
'''Cancels when''' predicate p returns true
Attributes
- Since
-
1.1.0
- Source
- Sink.scala
A Sink that will invoke the given function for every received element, giving it its previous output (or the given zero value) and the element as input. The returned scala.concurrent.Future will be completed with value of the final function evaluation when the input stream ends, or completed with Failure if there is a failure signaled in the stream.
A Sink that will invoke the given function for every received element, giving it its previous output (or the given zero value) and the element as input. The returned scala.concurrent.Future will be completed with value of the final function evaluation when the input stream ends, or completed with Failure if there is a failure signaled in the stream.
Attributes
- See also
- Source
- Sink.scala
A Sink that will invoke the given asynchronous function for every received element, giving it its previous output (or the given zero value) and the element as input. The returned scala.concurrent.Future will be completed with value of the final function evaluation when the input stream ends, or completed with Failure if there is a failure signaled in the stream.
A Sink that will invoke the given asynchronous function for every received element, giving it its previous output (or the given zero value) and the element as input. The returned scala.concurrent.Future will be completed with value of the final function evaluation when the input stream ends, or completed with Failure if there is a failure signaled in the stream.
Attributes
- See also
- Source
- Sink.scala
A Sink that will invoke the given function for every received element, giving it its previous output (or the given zero value) and the element as input. The returned scala.concurrent.Future will be completed with value of the final function evaluation when the input stream ends, predicate p returns false, or completed with Failure if there is a failure signaled in the stream.
A Sink that will invoke the given function for every received element, giving it its previous output (or the given zero value) and the element as input. The returned scala.concurrent.Future will be completed with value of the final function evaluation when the input stream ends, predicate p returns false, or completed with Failure if there is a failure signaled in the stream.
Attributes
- See also
- Since
-
1.1.0
- Source
- Sink.scala
A Sink that will test the given predicate p for every received element and
A Sink that will test the given predicate p for every received element and
- completes and returns scala.concurrent.Future of
trueif the predicate is true for all elements; - completes and returns scala.concurrent.Future of
trueif the stream is empty (i.e. completes before signalling any elements); - completes and returns scala.concurrent.Future of
falseif the predicate is false for any element.
The materialized value scala.concurrent.Future will be completed with the value true or false when the input stream ends, or completed with Failure if there is a failure signaled in the stream.
Adheres to the ActorAttributes.SupervisionStrategy attribute.
'''Completes when''' upstream completes or the predicate p returns false
'''Backpressures when''' the invocation of predicate p has not yet completed
'''Cancels when''' predicate p returns false
Attributes
- Since
-
1.1.0
- Source
- Sink.scala
A Sink that will invoke the given procedure for each received element. The sink is materialized into a scala.concurrent.Future which will be completed with Success when reaching the normal end of the stream, or completed with Failure if there is a failure signaled in the stream.
A Sink that will invoke the given procedure for each received element. The sink is materialized into a scala.concurrent.Future which will be completed with Success when reaching the normal end of the stream, or completed with Failure if there is a failure signaled in the stream.
Attributes
- Source
- Sink.scala
A Sink that will invoke the given procedure asynchronously for each received element. The sink is materialized into a scala.concurrent.Future which will be completed with Success when reaching the normal end of the stream, or completed with Failure if there is a failure signaled in the stream.
A Sink that will invoke the given procedure asynchronously for each received element. The sink is materialized into a scala.concurrent.Future which will be completed with Success when reaching the normal end of the stream, or completed with Failure if there is a failure signaled in the stream.
Attributes
- Source
- Sink.scala
A graph with the shape of a sink logically is a sink, this method makes it so also in type.
A graph with the shape of a sink logically is a sink, this method makes it so also in type.
Attributes
- Source
- Sink.scala
Defers the creation of a Sink until materialization. The factory function exposes Materializer which is going to be used during materialization and Attributes of the Sink returned by this method.
Defers the creation of a Sink until materialization. The factory function exposes Materializer which is going to be used during materialization and Attributes of the Sink returned by this method.
Attributes
- Source
- Sink.scala
Helper to create Sink from Subscriber.
Turn a Future[Sink] into a Sink that will consume the values of the source when the future completes successfully. If the Future is completed with a failure the stream is failed.
Turn a Future[Sink] into a Sink that will consume the values of the source when the future completes successfully. If the Future is completed with a failure the stream is failed.
The materialized future value is completed with the materialized value of the future sink or failed with a NeverMaterializedException if upstream fails or downstream cancels before the future has completed.
Attributes
- Source
- Sink.scala
A Sink that materializes into a Future of the first value received. If the stream completes before signaling at least a single element, the Future will be failed with a NoSuchElementException. If the stream signals an error errors before signaling at least a single element, the Future will be failed with the streams exception.
A Sink that materializes into a Future of the first value received. If the stream completes before signaling at least a single element, the Future will be failed with a NoSuchElementException. If the stream signals an error errors before signaling at least a single element, the Future will be failed with the streams exception.
See also headOption.
Attributes
- Source
- Sink.scala
A Sink that materializes into a Future of the optional first value received. If the stream completes before signaling at least a single element, the value of the Future will be scala.None. If the stream signals an error errors before signaling at least a single element, the Future will be failed with the streams exception.
A Sink that materializes into a Future of the optional first value received. If the stream completes before signaling at least a single element, the value of the Future will be scala.None. If the stream signals an error errors before signaling at least a single element, the Future will be failed with the streams exception.
See also head.
Attributes
- Source
- Sink.scala
A Sink that will consume the stream and discard the elements.
A Sink that materializes into a Future of the last value received. If the stream completes before signaling at least a single element, the Future will be failed with a NoSuchElementException. If the stream signals an error, the Future will be failed with the stream's exception.
A Sink that materializes into a Future of the last value received. If the stream completes before signaling at least a single element, the Future will be failed with a NoSuchElementException. If the stream signals an error, the Future will be failed with the stream's exception.
See also lastOption, takeLast.
Attributes
- Source
- Sink.scala
A Sink that materializes into a Future of the optional last value received. If the stream completes before signaling at least a single element, the value of the Future will be scala.None. If the stream signals an error, the Future will be failed with the stream's exception.
A Sink that materializes into a Future of the optional last value received. If the stream completes before signaling at least a single element, the value of the Future will be scala.None. If the stream signals an error, the Future will be failed with the stream's exception.
Attributes
- Source
- Sink.scala
Defers invoking the create function to create a future sink until there is a first element passed from upstream.
Defers invoking the create function to create a future sink until there is a first element passed from upstream.
The materialized future value is completed with the materialized value of the created sink when that has successfully been materialized.
If the create function throws or returns a future that is failed, or the stream fails to materialize, in this case the materialized future value is failed with a pekko.stream.NeverMaterializedException.
Attributes
- Source
- Sink.scala
Defers invoking the create function to create a sink until there is a first element passed from upstream.
Defers invoking the create function to create a sink until there is a first element passed from upstream.
The materialized future value is completed with the materialized value of the created sink when that has successfully been materialized.
If the create function throws or returns or the stream fails to materialize, in this case the materialized future value is failed with a pekko.stream.NeverMaterializedException.
Attributes
- Source
- Sink.scala
A Sink that will always backpressure never cancel and never consume any elements from the stream.
A Sink that will always backpressure never cancel and never consume any elements from the stream.
Attributes
- Source
- Sink.scala
A Sink that when the flow is completed, either through a failure or normal completion, apply the provided function with scala.util.Success or scala.util.Failure.
A Sink that when the flow is completed, either through a failure or normal completion, apply the provided function with scala.util.Success or scala.util.Failure.
Attributes
- Source
- Sink.scala
Creates a Sink that is materialized as an pekko.stream.scaladsl.SinkQueueWithCancel. pekko.stream.scaladsl.SinkQueueWithCancel.pull method is pulling element from the stream and returns Future[Option[T]. Future completes when element is available.
Creates a Sink that is materialized as an pekko.stream.scaladsl.SinkQueueWithCancel. pekko.stream.scaladsl.SinkQueueWithCancel.pull method is pulling element from the stream and returns Future[Option[T]. Future completes when element is available.
Before calling pull method second time you need to ensure that number of pending pulls is less then maxConcurrentPulls or wait until some of the previous Futures completes. Pull returns Failed future with ''IllegalStateException'' if there will be more then maxConcurrentPulls number of pending pulls.
Sink will request at most number of elements equal to size of inputBuffer from upstream and then stop back pressure. You can configure size of input buffer by using Sink.withAttributes method.
For stream completion you need to pull all elements from pekko.stream.scaladsl.SinkQueueWithCancel including last None as completion marker
Attributes
- Source
- Sink.scala
Creates a Sink that is materialized as an pekko.stream.scaladsl.SinkQueueWithCancel. pekko.stream.scaladsl.SinkQueueWithCancel.pull method is pulling element from the stream and returns Future[Option[T]]. Future completes when element is available.
Creates a Sink that is materialized as an pekko.stream.scaladsl.SinkQueueWithCancel. pekko.stream.scaladsl.SinkQueueWithCancel.pull method is pulling element from the stream and returns Future[Option[T]]. Future completes when element is available.
Before calling pull method second time you need to wait until previous Future completes. Pull returns Failed future with ''IllegalStateException'' if previous future has not yet completed.
Sink will request at most number of elements equal to size of inputBuffer from upstream and then stop back pressure. You can configure size of input buffer by using Sink.withAttributes method.
For stream completion you need to pull all elements from pekko.stream.scaladsl.SinkQueueWithCancel including last None as completion marker
Attributes
- Source
- Sink.scala
A Sink that will invoke the given function for every received element, giving it its previous output (from the second element) and the element as input. The returned scala.concurrent.Future will be completed with value of the final function evaluation when the input stream ends, or completed with Failure if there is a failure signaled in the stream.
A Sink that will invoke the given function for every received element, giving it its previous output (from the second element) and the element as input. The returned scala.concurrent.Future will be completed with value of the final function evaluation when the input stream ends, or completed with Failure if there is a failure signaled in the stream.
If the stream is empty (i.e. completes before signalling any elements), the reduce operator will fail its downstream with a NoSuchElementException, which is semantically in-line with that Scala's standard library collections do in such situations.
Adheres to the ActorAttributes.SupervisionStrategy attribute.
Attributes
- Source
- Sink.scala
A Sink that keeps on collecting incoming elements until upstream terminates. As upstream may be unbounded, Flow[T].take or the stricter Flow[T].limit (and their variants) may be used to ensure boundedness. Materializes into a Future of Seq[T] containing all the collected elements. Seq is limited to Int.MaxValue elements, this Sink will cancel the stream after having received that many elements.
A Sink that keeps on collecting incoming elements until upstream terminates. As upstream may be unbounded, Flow[T].take or the stricter Flow[T].limit (and their variants) may be used to ensure boundedness. Materializes into a Future of Seq[T] containing all the collected elements. Seq is limited to Int.MaxValue elements, this Sink will cancel the stream after having received that many elements.
See also Flow.limit, Flow.limitWeighted, Flow.take, Flow.takeWithin, Flow.takeWhile
Attributes
- Source
- Sink.scala
INTERNAL API
A Sink that materializes into a Future of immutable.Seq[T] containing the last n collected elements.
A Sink that materializes into a Future of immutable.Seq[T] containing the last n collected elements.
If the stream completes before signaling at least n elements, the Future will complete with all elements seen so far. If the stream never completes, the Future will never complete. If there is a failure signaled in the stream the Future will be completed with failure.
Attributes
- Source
- Sink.scala
Deprecated methods
Sends the elements of the stream to the given ActorRef. If the target actor terminates the stream will be canceled. When the stream is completed successfully the given onCompleteMessage will be sent to the destination actor. When the stream is completed with failure a pekko.actor.Status.Failure message will be sent to the destination actor.
Sends the elements of the stream to the given ActorRef. If the target actor terminates the stream will be canceled. When the stream is completed successfully the given onCompleteMessage will be sent to the destination actor. When the stream is completed with failure a pekko.actor.Status.Failure message will be sent to the destination actor.
It will request at most maxInputBufferSize number of elements from upstream, but there is no back-pressure signal from the destination actor, i.e. if the actor is not consuming the messages fast enough the mailbox of the actor will grow. For potentially slow consumer actors it is recommended to use a bounded mailbox with zero mailbox-push-timeout-time or use a rate limiting operator in front of this Sink.
Attributes
- Deprecated
- true
- Source
- Sink.scala
Sends the elements of the stream to the given ActorRef that sends back back-pressure signal. First element is always onInitMessage, then stream is waiting for acknowledgement message ackMessage from the given actor which means that it is ready to process elements. It also requires ackMessage message after each stream element to make backpressure work.
Sends the elements of the stream to the given ActorRef that sends back back-pressure signal. First element is always onInitMessage, then stream is waiting for acknowledgement message ackMessage from the given actor which means that it is ready to process elements. It also requires ackMessage message after each stream element to make backpressure work.
If the target actor terminates the stream will be canceled. When the stream is completed successfully the given onCompleteMessage will be sent to the destination actor. When the stream is completed with failure - result of onFailureMessage(throwable) function will be sent to the destination actor.
Attributes
- Deprecated
- true
- Source
- Sink.scala
A Sink that will invoke the given function to each of the elements as they pass in. The sink is materialized into a scala.concurrent.Future
A Sink that will invoke the given function to each of the elements as they pass in. The sink is materialized into a scala.concurrent.Future
If f throws an exception and the supervision decision is pekko.stream.Supervision.Stop the Future will be completed with failure.
If f throws an exception and the supervision decision is pekko.stream.Supervision.Resume or pekko.stream.Supervision.Restart the element is dropped and the stream continues.
See also Flow.mapAsyncUnordered
Attributes
- Deprecated
-
[Since version Akka 2.5.17] - Source
- Sink.scala
Creates a real Sink upon receiving the first element. Internal Sink will not be created if there are no elements, because of completion or error.
Creates a real Sink upon receiving the first element. Internal Sink will not be created if there are no elements, because of completion or error.
If upstream completes before an element was received then the Future is completed with the value created by fallback. If upstream fails before an element was received, sinkFactory throws an exception, or materialization of the internal sink fails then the Future is completed with the exception. Otherwise the Future is completed with the materialized value of the internal sink.
Attributes
- Deprecated
- true
- Source
- Sink.scala
Creates a real Sink upon receiving the first element. Internal Sink will not be created if there are no elements, because of completion or error.
Creates a real Sink upon receiving the first element. Internal Sink will not be created if there are no elements, because of completion or error.
If upstream completes before an element was received then the Future is completed with None. If upstream fails before an element was received, sinkFactory throws an exception, or materialization of the internal sink fails then the Future is completed with the exception. Otherwise the Future is completed with the materialized value of the internal sink.
Attributes
- Deprecated
- true
- Source
- Sink.scala
Defers the creation of a Sink until materialization. The factory function exposes ActorMaterializer which is going to be used during materialization and Attributes of the Sink returned by this method.
Defers the creation of a Sink until materialization. The factory function exposes ActorMaterializer which is going to be used during materialization and Attributes of the Sink returned by this method.
Attributes
- Deprecated
- true
- Source
- Sink.scala