public class ActorReceiver<T> extends Receiver<T> implements Logging
As Actors can also be used to receive data from almost any stream source. A nice set of abstraction(s) for actors as receivers is already provided for a few general cases. It is thus exposed as an API where user may come with their own Actor to run as receiver for Spark Streaming input source.
This starts a supervisor actor which starts workers and also provides [http://doc.akka.io/docs/akka/snapshot/scala/fault-tolerance.html fault-tolerance].
Here's a way to start more supervisor/workers as its children.
Modifier and Type | Class and Description |
---|---|
class |
ActorReceiver.Supervisor |
Constructor and Description |
---|
ActorReceiver(akka.actor.Props props,
String name,
StorageLevel storageLevel,
akka.actor.SupervisorStrategy receiverSupervisorStrategy,
scala.reflect.ClassTag<T> evidence$1) |
Modifier and Type | Method and Description |
---|---|
void |
onStart()
This method is called by the system when the receiver is started.
|
void |
onStop()
This method is called by the system when the receiver is stopped.
|
attachExecutor, executor_, isStarted, isStopped, preferredLocation, reportError, restart, restart, restart, setReceiverId, stop, stop, storageLevel, store, store, store, store, store, store, store, store, store, streamId
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
initializeIfNecessary, initializeLogging, isTraceEnabled, log_, log, logDebug, logDebug, logError, logError, logInfo, logInfo, logName, logTrace, logTrace, logWarning, logWarning
public ActorReceiver(akka.actor.Props props, String name, StorageLevel storageLevel, akka.actor.SupervisorStrategy receiverSupervisorStrategy, scala.reflect.ClassTag<T> evidence$1)
public void onStart()
Receiver
store(data)
.
If there are errors in threads started here, then following options can be done
(i) reportError(...)
can be called to report the error to the driver.
The receiving of data will continue uninterrupted.
(ii) stop(...)
can be called to stop receiving data. This will call onStop()
to
clear up all resources allocated (threads, buffers, etc.) during onStart()
.
(iii) restart(...)
can be called to restart the receiver. This will call onStop()
immediately, and then onStart()
after a delay.