object Sink

Java API

Source
Sink.scala
Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Sink
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. def actorRef[In](ref: ActorRef, onCompleteMessage: Any): Sink[In, NotUsed]

    Sends the elements of the stream to the given ActorRef.

    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 akka.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.

  5. def actorRefWithAck[In](ref: ActorRef, onInitMessage: Any, ackMessage: Any, onCompleteMessage: Any, onFailureMessage: Function[Throwable, Any]): Sink[In, NotUsed]

    Sends the elements of the stream to the given ActorRef that sends back back-pressure signal.

    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) message will be sent to the destination actor.

  6. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  7. def asPublisher[T](fanout: AsPublisher): Sink[T, Publisher[T]]

    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.

  8. def cancelled[T](): Sink[T, NotUsed]

    A Sink that immediately cancels its upstream after materialization.

  9. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate() @throws( ... )
  10. def combine[T, U](output1: Sink[U, _], output2: Sink[U, _], rest: List[Sink[U, _]], strategy: Function[Integer, Graph[UniformFanOutShape[T, U], NotUsed]]): Sink[T, NotUsed]

    Combine several sinks with fan-out strategy like Broadcast or Balance and returns Sink.

  11. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  12. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  13. def fold[U, In](zero: U, f: Function2[U, In, U]): Sink[In, CompletionStage[U]]

    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.

    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 java.util.concurrent.CompletionStage will be completed with value of the final function evaluation when the input stream ends, or completed with Failure if there is a failure is signaled in the stream.

  14. def foldAsync[U, In](zero: U, f: Function2[U, In, CompletionStage[U]]): Sink[In, CompletionStage[U]]

    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.

    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 java.util.concurrent.CompletionStage will be completed with value of the final function evaluation when the input stream ends, or completed with Failure if there is a failure is signaled in the stream.

  15. def foreach[T](f: Procedure[T]): Sink[T, CompletionStage[Done]]

    A Sink that will invoke the given procedure for each received element.

    A Sink that will invoke the given procedure for each received element. The sink is materialized into a java.util.concurrent.CompletionStage 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.

  16. def foreachAsync[T](parallelism: Int)(f: Function[T, CompletionStage[Void]]): Sink[T, CompletionStage[Done]]

    A Sink that will invoke the given procedure asynchronously for each received element.

    A Sink that will invoke the given procedure asynchronously for each received element. The sink is materialized into a java.util.concurrent.CompletionStage 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.

  17. def fromGraph[T, M](g: Graph[SinkShape[T], M]): Sink[T, M]

    A graph with the shape of a sink logically is a sink, this method makes it so also in type.

  18. def fromSubscriber[In](subs: Subscriber[In]): Sink[In, NotUsed]

    Helper to create Sink from Subscriber.

  19. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  20. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  21. def head[In](): Sink[In, CompletionStage[In]]

    A Sink that materializes into a CompletionStage of the first value received.

    A Sink that materializes into a CompletionStage of the first value received. If the stream completes before signaling at least a single element, the CompletionStage will be failed with a NoSuchElementException. If the stream signals an error before signaling at least a single element, the CompletionStage will be failed with the streams exception.

    See also headOption.

  22. def headOption[In](): Sink[In, CompletionStage[Optional[In]]]

    A Sink that materializes into a CompletionStage of the optional first value received.

    A Sink that materializes into a CompletionStage of the optional first value received. If the stream completes before signaling at least a single element, the value of the CompletionStage will be an empty java.util.Optional. If the stream signals an error errors before signaling at least a single element, the CompletionStage will be failed with the streams exception.

    See also head.

  23. def ignore[T](): Sink[T, CompletionStage[Done]]

    A Sink that will consume the stream and discard the elements.

  24. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  25. def last[In](): Sink[In, CompletionStage[In]]

    A Sink that materializes into a CompletionStage of the last value received.

    A Sink that materializes into a CompletionStage of the last value received. If the stream completes before signaling at least a single element, the CompletionStage will be failed with a NoSuchElementException. If the stream signals an error errors before signaling at least a single element, the CompletionStage will be failed with the streams exception.

    See also lastOption, takeLast.

  26. def lastOption[In](): Sink[In, CompletionStage[Optional[In]]]

    A Sink that materializes into a CompletionStage of the optional last value received.

    A Sink that materializes into a CompletionStage of the optional last value received. If the stream completes before signaling at least a single element, the value of the CompletionStage will be an empty java.util.Optional. If the stream signals an error errors before signaling at least a single element, the CompletionStage will be failed with the streams exception.

    See also head, takeLast.

  27. def lazyInitAsync[T, M](sinkFactory: Creator[CompletionStage[Sink[T, M]]]): Sink[T, CompletionStage[Optional[M]]]

    Creates a real Sink upon receiving the first element.

    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.

  28. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  29. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  30. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  31. def onComplete[In](callback: Procedure[Try[Done]]): Sink[In, NotUsed]

    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.

  32. def queue[T](): Sink[T, SinkQueueWithCancel[T]]

    Creates a Sink that is materialized as an akka.stream.javadsl.SinkQueue.

    Creates a Sink that is materialized as an akka.stream.javadsl.SinkQueue. akka.stream.javadsl.SinkQueue.pull method is pulling element from the stream and returns CompletionStage[Option[T]]. CompletionStage completes when element is available.

    Before calling pull method second time you need to wait until previous CompletionStage 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 akka.stream.javadsl.SinkQueue including last None as completion marker

    See also

    akka.stream.javadsl.SinkQueueWithCancel

  33. def reduce[In](f: Function2[In, In, In]): Sink[In, CompletionStage[In]]

    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.

    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 java.util.concurrent.CompletionStage 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.

  34. def seq[In]: Sink[In, CompletionStage[List[In]]]

    A Sink that keeps on collecting incoming elements until upstream terminates.

    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 CompletionStage of Seq[T] containing all the collected elements. List is limited to Integer.MAX_VALUE 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

  35. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  36. def takeLast[In](n: Int): Sink[In, CompletionStage[List[In]]]

    A Sink that materializes into a a CompletionStage of List<In> containing the last n collected elements.

    A Sink that materializes into a a CompletionStage of List<In> containing the last n collected elements.

    If the stream completes before signaling at least n elements, the CompletionStage will complete with all elements seen so far. If the stream never completes the CompletionStage will never complete. If there is a failure signaled in the stream the CompletionStage will be completed with failure.

  37. def toString(): String
    Definition Classes
    AnyRef → Any
  38. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  39. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )
  40. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Deprecated Value Members

  1. def actorSubscriber[T](props: Props): Sink[T, ActorRef]

    Creates a Sink that is materialized to an akka.actor.ActorRef which points to an Actor created according to the passed in akka.actor.Props.

    Creates a Sink that is materialized to an akka.actor.ActorRef which points to an Actor created according to the passed in akka.actor.Props. Actor created by the props should be akka.stream.actor.ActorSubscriber.

    Annotations
    @deprecated
    Deprecated

    (Since version 2.5.0) Use akka.stream.stage.GraphStage and fromGraph instead, it allows for all operations an Actor would and is more type-safe as well as guaranteed to be ReactiveStreams compliant.

  2. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @Deprecated @deprecated @throws( classOf[java.lang.Throwable] )
    Deprecated

    (Since version ) see corresponding Javadoc for more information.

  3. def foreachParallel[T](parallel: Int)(f: Procedure[T])(ec: ExecutionContext): Sink[T, CompletionStage[Done]]

    A Sink that will invoke the given procedure for each received element in parallel.

    A Sink that will invoke the given procedure for each received element in parallel. The sink is materialized into a java.util.concurrent.CompletionStage.

    If f throws an exception and the supervision decision is akka.stream.Supervision.Stop the CompletionStage will be completed with failure.

    If f throws an exception and the supervision decision is akka.stream.Supervision.Resume or akka.stream.Supervision.Restart the element is dropped and the stream continues.

    Annotations
    @deprecated
    Deprecated

    (Since version 2.5.17) Use foreachAsync instead, it allows you to choose how to run the procedure, by calling some other API returning a CompletionStage or using CompletableFuture.supplyAsync.

  4. def lazyInit[T, M](sinkFactory: Function[T, CompletionStage[Sink[T, M]]], fallback: Creator[M]): Sink[T, CompletionStage[M]]

    Creates a real Sink upon receiving the first element.

    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.

    Annotations
    @Deprecated @deprecated
    Deprecated

    (Since version 2.5.11) Use lazyInitAsync instead. (lazyInitAsync no more needs a fallback function and the materialized value more clearly indicates if the internal sink was materialized or not.)

Inherited from AnyRef

Inherited from Any

Ungrouped