Class ActorSource$


  • public class ActorSource$
    extends java.lang.Object
    Collection of Sources aimed at integrating with typed Actors.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static ActorSource$ MODULE$
      Static reference to the singleton instance of this Scala object.
    • Constructor Summary

      Constructors 
      Constructor Description
      ActorSource$()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      <T> Source<T,​ActorRef<T>> actorRef​(java.util.function.Predicate<T> completionMatcher, scala.PartialFunction<T,​java.lang.Throwable> failureMatcher, int bufferSize, OverflowStrategy overflowStrategy)
      Creates a Source that is materialized as an ActorRef.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • MODULE$

        public static final ActorSource$ MODULE$
        Static reference to the singleton instance of this Scala object.
    • Constructor Detail

      • ActorSource$

        public ActorSource$()
    • Method Detail

      • actorRef

        public <T> Source<T,​ActorRef<T>> actorRef​(java.util.function.Predicate<T> completionMatcher,
                                                        scala.PartialFunction<T,​java.lang.Throwable> failureMatcher,
                                                        int bufferSize,
                                                        OverflowStrategy overflowStrategy)
        Creates a Source that is materialized as an ActorRef. Messages sent to this actor will be emitted to the stream if there is demand from downstream, otherwise they will be buffered until request for demand is received.

        Depending on the defined OverflowStrategy it might drop elements if there is no space available in the buffer.

        The strategy akka.stream.OverflowStrategy.backpressure is not supported, and an IllegalArgument("Backpressure overflowStrategy not supported") will be thrown if it is passed as argument.

        The buffer can be disabled by using bufferSize of 0 and then received messages are dropped if there is no demand from downstream. When bufferSize is 0 the overflowStrategy does not matter. An async boundary is added after this Source; as such, it is never safe to assume the downstream will always generate demand.

        The stream can be completed successfully by sending the actor reference a Status.Success (whose content will be ignored) in which case already buffered elements will be signaled before signaling completion, or by sending PoisonPill in which case completion will be signaled immediately.

        The stream can be completed with failure by sending a Status.Failure to the actor reference. In case the Actor is still draining its internal buffer (after having received a Status.Success) before signaling completion and it receives a Status.Failure, the failure will be signaled downstream immediately (instead of the completion signal).

        The actor will be stopped when the stream is completed, failed or canceled from downstream, i.e. you can watch it to get notified when that happens.

        See also akka.stream.javadsl.Source.queue.

        Parameters:
        bufferSize - The size of the buffer in element count
        overflowStrategy - Strategy that is used when incoming elements cannot fit inside the buffer
        completionMatcher - (undocumented)
        failureMatcher - (undocumented)
        Returns:
        (undocumented)