Class ActorSink$
- java.lang.Object
-
- akka.stream.typed.javadsl.ActorSink$
-
public class ActorSink$ extends java.lang.ObjectCollection of Sinks aimed at integrating with typed Actors.
-
-
Field Summary
Fields Modifier and Type Field Description static ActorSink$MODULE$Static reference to the singleton instance of this Scala object.
-
Constructor Summary
Constructors Constructor Description ActorSink$()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> Sink<T,NotUsed>actorRef(ActorRef<T> ref, T onCompleteMessage, Function<java.lang.Throwable,T> onFailureMessage)Sends the elements of the stream to the givenActorRef.<T,M,A>
Sink<T,NotUsed>actorRefWithBackpressure(ActorRef<M> ref, Function2<ActorRef<A>,T,M> messageAdapter, Function<ActorRef<A>,M> onInitMessage, A ackMessage, M onCompleteMessage, Function<java.lang.Throwable,M> onFailureMessage)Sends the elements of the stream to the givenActorRefthat sends back back-pressure signal.<T,M,A>
Sink<T,NotUsed>actorRefWithBackpressure(ActorRef<M> ref, Function2<ActorRef<A>,T,M> messageAdapter, Function<ActorRef<A>,M> onInitMessage, M onCompleteMessage, Function<java.lang.Throwable,M> onFailureMessage)Sends the elements of the stream to the givenActorRefthat sends back back-pressure signal.
-
-
-
Field Detail
-
MODULE$
public static final ActorSink$ MODULE$
Static reference to the singleton instance of this Scala object.
-
-
Method Detail
-
actorRef
public <T> Sink<T,NotUsed> actorRef(ActorRef<T> ref, T onCompleteMessage, Function<java.lang.Throwable,T> onFailureMessage)
Sends the elements of the stream to the givenActorRef. If the target actor terminates the stream will be canceled. When the stream is completed successfully the givenonCompleteMessagewill be sent to the destination actor. When the stream is completed with failure a the throwable that was signaled to the stream is adapted to the Actors protocol usingonFailureMessageand then then sent to the destination actor.It will request at most
maxInputBufferSizenumber 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 zeromailbox-push-timeout-timeor use a rate limiting operator in front of thisSink.
-
actorRefWithBackpressure
public <T,M,A> Sink<T,NotUsed> actorRefWithBackpressure(ActorRef<M> ref, Function2<ActorRef<A>,T,M> messageAdapter, Function<ActorRef<A>,M> onInitMessage, A ackMessage, M onCompleteMessage, Function<java.lang.Throwable,M> onFailureMessage)
Sends the elements of the stream to the givenActorRefthat sends back back-pressure signal. First element is alwaysonInitMessage, then stream is waiting for acknowledgement messageackMessagefrom the given actor which means that it is ready to process elements. It also requiresackMessagemessage 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
onCompleteMessagewill be sent to the destination actor. When the stream is completed with failure - result ofonFailureMessage(throwable)function will be sent to the destination actor.- Parameters:
ref- the receiving actor asActorRef(whereTmust include the control messages below)messageAdapter- a function that wraps the stream elements to be sent to the actor together with anActorRef[A]which accepts the ack messageonInitMessage- a function that wraps anActorRefinto a messages to couple the receiving actor to the sinkackMessage- a fixed message that is expected after every element sent to the receiving actoronCompleteMessage- the message to be sent to the actor when the stream completesonFailureMessage- a function that creates a message to be sent to the actor in case the stream fails from aThrowable
-
actorRefWithBackpressure
public <T,M,A> Sink<T,NotUsed> actorRefWithBackpressure(ActorRef<M> ref, Function2<ActorRef<A>,T,M> messageAdapter, Function<ActorRef<A>,M> onInitMessage, M onCompleteMessage, Function<java.lang.Throwable,M> onFailureMessage)
Sends the elements of the stream to the givenActorRefthat sends back back-pressure signal. First element is alwaysonInitMessage, 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
onCompleteMessagewill be sent to the destination actor. When the stream is completed with failure - result ofonFailureMessage(throwable)function will be sent to the destination actor.- Parameters:
ref- the receiving actor asActorRef(whereTmust include the control messages below)messageAdapter- a function that wraps the stream elements to be sent to the actor together with anActorRef[A]which accepts the ack messageonInitMessage- a function that wraps anActorRefinto a messages to couple the receiving actor to the sinkonCompleteMessage- the message to be sent to the actor when the stream completesonFailureMessage- a function that creates a message to be sent to the actor in case the stream fails from aThrowable
-
-