Class AbstractStreamingActor<C,E>
- java.lang.Object
-
- akka.actor.AbstractActor
-
- org.eclipse.ditto.services.utils.akka.streaming.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.AbstractActorAbstract actor that responds to each command by streaming elements from a source to the sender of the command.
-
-
Field Summary
Fields Modifier and Type Field Description protected akka.event.DiagnosticLoggingAdapterlogLogger for this actor.protected akka.stream.MaterializermaterializerActor materializer of this actor's system.
-
Constructor Summary
Constructors Constructor Description AbstractStreamingActor()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected ObjectbatchMessages(List<E> elements)Batch elements together into 1 message.akka.actor.AbstractActor.ReceivecreateReceive()protected abstract akka.stream.javadsl.Source<E,akka.NotUsed>createSource(C command)Starts a source of elements according to the command.protected abstract intgetBurst(C command)Extract batch size from a command.protected abstract Class<C>getCommandClass()protected abstract DurationgetIdleTimeout(C command)Extract idle timeout.protected abstract DurationgetInitialTimeout(C command)Extract initial timeout.-
Methods inherited from class akka.actor.AbstractActor
akka$actor$Actor$_setter_$context_$eq, akka$actor$Actor$_setter_$self_$eq, aroundPostRestart, aroundPostStop, aroundPreRestart, aroundPreStart, aroundReceive, context, emptyBehavior, getContext, getSelf, getSender, postRestart, postStop, preRestart, preRestart, preStart, receive, receiveBuilder, self, sender, supervisorStrategy, unhandled
-
-
-
-
Method Detail
-
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:
createReceivein classakka.actor.AbstractActor
-
-