Class AbstractStreamingActor<C,​E>

  • Type Parameters:
    C - Type of commands to start a stream.
    E - Type of elements of a stream.
    All Implemented Interfaces:
    akka.actor.Actor

    public abstract class AbstractStreamingActor<C,​E>
    extends akka.actor.AbstractActor
    Abstract actor that responds to each command by streaming elements from a source to the sender of the command.
    • Nested Class Summary

      • Nested classes/interfaces inherited from class akka.actor.AbstractActor

        akka.actor.AbstractActor.ActorContext, akka.actor.AbstractActor.Receive
      • Nested classes/interfaces inherited from interface akka.actor.Actor

        akka.actor.Actor.emptyBehavior$, akka.actor.Actor.ignoringBehavior$
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected akka.event.DiagnosticLoggingAdapter log
      Logger for this actor.
      protected akka.stream.Materializer materializer
      Actor materializer of this actor's system.
    • Field Detail

      • log

        protected final akka.event.DiagnosticLoggingAdapter log
        Logger for this actor.
      • materializer

        protected final akka.stream.Materializer materializer
        Actor materializer of this actor's system.
    • Constructor Detail

      • AbstractStreamingActor

        public AbstractStreamingActor()
    • Method Detail

      • getCommandClass

        protected abstract Class<C> getCommandClass()
        Returns:
        Class of the commands.
      • getBurst

        protected abstract int getBurst​(C command)
        Extract batch size from a command. The rate specifies the number of elements to be sent per message.
        Parameters:
        command - The command to start a stream.
        Returns:
        The number of elements to be streamed per second.
      • getInitialTimeout

        protected abstract Duration getInitialTimeout​(C command)
        Extract initial timeout.
        Parameters:
        command - The command to start a stream.
        Returns:
        The initial timeout.
      • getIdleTimeout

        protected abstract Duration getIdleTimeout​(C command)
        Extract idle timeout.
        Parameters:
        command - The command to start a stream.
        Returns:
        The idle timeout.
      • createSource

        protected abstract akka.stream.javadsl.Source<E,​akka.NotUsed> createSource​(C command)
        Starts a source of elements according to the command.
        Parameters:
        command - The command to start a stream.
        Returns:
        A source of elements to stream to the recipient.
      • batchMessages

        protected Object batchMessages​(List<E> elements)
        Batch elements together into 1 message. Default to the first element of the list if it is a singleton and the list itself otherwise.
        Parameters:
        elements - Elements from the source.
        Returns:
        A batched message.
      • createReceive

        public final akka.actor.AbstractActor.Receive createReceive()
        Specified by:
        createReceive in class akka.actor.AbstractActor