Class

pt.tecnico.dsi.akkastrator

AbstractOrchestrator

Related Doc: package akkastrator

Permalink

sealed abstract class AbstractOrchestrator extends PersistentActor with AtLeastOnceDelivery with ActorLogging with IdImplicits

An Orchestrator executes a set of, possibly dependent, Tasks. A task corresponds to sending a message to an actor, handling its response and possibly mutate the internal state of the Orchestrator.

The Orchestrator together with the Task is able to:

NOTE: the responses that are received must be Serializable.

In order for the Orchestrator and the Tasks to be able to achieve all of this they have to access and modify each others state directly. This means they are very tightly coupled with each other. To make this relation more obvious and to enforce it, you will only be able to create tasks inside an orchestrator.

If you have the need to refactor the creation of tasks so that you can use them in multiple orchestrators you can leverage self type annotations like so:

trait DatabaseTasks { self: Orchestrator =>
  def createQueryTask(): Task = new Task("") {
    val destination: ActorPath = ???
    def createMessage(correlationId: CorrelationId): Any = ???

    def behavior: Receive = ???
  }
}
Linear Supertypes
Known Subclasses
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. AbstractOrchestrator
  2. IdImplicits
  3. ActorLogging
  4. AtLeastOnceDelivery
  5. AtLeastOnceDeliveryLike
  6. PersistentActor
  7. Eventsourced
  8. PersistenceRecovery
  9. PersistenceIdentity
  10. PersistenceStash
  11. StashFactory
  12. Stash
  13. RequiresMessageQueue
  14. UnrestrictedStash
  15. StashSupport
  16. Snapshotter
  17. Actor
  18. AnyRef
  19. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. abstract type ID <: Id

    Permalink
  2. type Receive = PartialFunction[Any, Unit]

    Permalink
    Definition Classes
    Actor
  3. abstract type S <: State

    Permalink

Abstract Value Members

  1. abstract def ID2DeliveryId(destination: ActorPath, id: Long): DeliveryId

    Permalink

    Converts ID to the deliveryId needed for the confirmDelivery method of akka-persistence.

    Converts ID to the deliveryId needed for the confirmDelivery method of akka-persistence.

    Attributes
    protected[pt.tecnico.dsi.akkastrator]
  2. abstract def deliveryId2ID(destination: ActorPath, deliveryId: DeliveryId): ID

    Permalink

    Converts the deliveryId obtained from the deliver method of akka-persistence to ID.

    Converts the deliveryId obtained from the deliver method of akka-persistence to ID. Also updates this orchestrator state if necessary.

    Attributes
    protected[pt.tecnico.dsi.akkastrator]
  3. abstract def matchId(task: Task[_], id: Long): Boolean

    Permalink
    Attributes
    protected[pt.tecnico.dsi.akkastrator]
  4. abstract def persistenceId: String

    Permalink
    Definition Classes
    PersistenceIdentity

Concrete Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. def aroundPostRestart(reason: Throwable): Unit

    Permalink
    Attributes
    protected[akka]
    Definition Classes
    Eventsourced → Actor
  5. def aroundPostStop(): Unit

    Permalink
    Attributes
    protected[akka]
    Definition Classes
    AtLeastOnceDeliveryLike → Eventsourced → Actor
  6. def aroundPreRestart(reason: Throwable, message: Option[Any]): Unit

    Permalink
    Attributes
    protected[akka]
    Definition Classes
    AtLeastOnceDeliveryLike → Eventsourced → Actor
  7. def aroundPreStart(): Unit

    Permalink
    Attributes
    protected[akka]
    Definition Classes
    Eventsourced → Actor
  8. def aroundReceive(receive: Receive, message: Any): Unit

    Permalink
    Attributes
    protected[akka]
    Definition Classes
    AtLeastOnceDeliveryLike → Eventsourced → Actor
  9. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  10. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  11. def confirmDelivery(deliveryId: Long): Boolean

    Permalink
    Definition Classes
    AtLeastOnceDeliveryLike
  12. implicit val context: ActorContext

    Permalink
    Definition Classes
    Actor
  13. def deferAsync[A](event: A)(handler: (A) ⇒ Unit): Unit

    Permalink
    Definition Classes
    Eventsourced
  14. def deleteMessages(toSequenceNr: Long): Unit

    Permalink
    Definition Classes
    Eventsourced
  15. def deleteSnapshot(sequenceNr: Long): Unit

    Permalink
    Definition Classes
    Snapshotter
  16. def deleteSnapshots(criteria: SnapshotSelectionCriteria): Unit

    Permalink
    Definition Classes
    Snapshotter
  17. def deliver(destination: ActorSelection)(deliveryIdToMessage: (Long) ⇒ Any): Unit

    Permalink
    Definition Classes
    AtLeastOnceDeliveryLike
  18. def deliver(destination: ActorPath)(deliveryIdToMessage: (Long) ⇒ Any): Unit

    Permalink
    Definition Classes
    AtLeastOnceDeliveryLike
  19. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  20. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  21. def extraCommands: akka.actor.Actor.Receive

    Permalink

    Override this method to add extra commands that are always handled by this orchestrator (except when recovering).

  22. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  23. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  24. def getDeliverySnapshot: AtLeastOnceDeliverySnapshot

    Permalink
    Definition Classes
    AtLeastOnceDeliveryLike
  25. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  26. def internalStashOverflowStrategy: StashOverflowStrategy

    Permalink
    Definition Classes
    PersistenceStash
  27. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  28. def journalPluginId: String

    Permalink
    Definition Classes
    PersistenceIdentity
  29. def lastSequenceNr: Long

    Permalink
    Definition Classes
    Eventsourced
  30. def loadSnapshot(persistenceId: String, criteria: SnapshotSelectionCriteria, toSequenceNr: Long): Unit

    Permalink
    Definition Classes
    Snapshotter
  31. def log: LoggingAdapter

    Permalink
    Definition Classes
    ActorLogging
  32. implicit def longToCorrelationId(l: Long): CorrelationId

    Permalink
    Definition Classes
    IdImplicits
  33. implicit def longToDeliveryId(l: Long): DeliveryId

    Permalink
    Definition Classes
    IdImplicits
  34. def maxUnconfirmedMessages: Int

    Permalink
    Definition Classes
    AtLeastOnceDeliveryLike
  35. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  36. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  37. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  38. def numberOfUnconfirmed: Int

    Permalink
    Definition Classes
    AtLeastOnceDeliveryLike
  39. def onAbort(instigator: Task[_], message: Any, tasks: Map[TaskState, Seq[Task[_]]]): Unit

    Permalink

    User overridable callback.

    User overridable callback. Its called when a task instigates an abort. By default logs that the Orchestrator has aborted then stops it.

    instigator

    the task that instigated the abort.

    message

    the message that caused the abort.

    tasks

    Map with the tasks states at the moment of abort.

    Note

    if you invoke become/unbecome inside this method, the contract that states "Tasks that are waiting will remain untouched and the orchestrator will still be prepared to handle their responses" will no longer be guaranteed.

  40. def onFinish(): Unit

    Permalink

    User overridable callback.

    User overridable callback. Its called once every task finishes. By default logs that the Orchestrator has finished then stops it.

    You can use this to implement your termination strategy.

    An Orchestrator without tasks never finishes.

  41. def onPersistFailure(cause: Throwable, event: Any, seqNr: Long): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    Eventsourced
  42. def onPersistRejected(cause: Throwable, event: Any, seqNr: Long): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    Eventsourced
  43. def onRecoveryFailure(cause: Throwable, event: Option[Any]): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    Eventsourced
  44. implicit final val orchestrator: AbstractOrchestrator

    Permalink
  45. final def orchestratorCommand: akka.actor.Actor.Receive

    Permalink
  46. def persist[A](event: A)(handler: (A) ⇒ Unit): Unit

    Permalink
    Definition Classes
    Eventsourced
  47. def persistAll[A](events: Seq[A])(handler: (A) ⇒ Unit): Unit

    Permalink
    Definition Classes
    Eventsourced
  48. def persistAllAsync[A](events: Seq[A])(handler: (A) ⇒ Unit): Unit

    Permalink
    Definition Classes
    Eventsourced
  49. def persistAsync[A](event: A)(handler: (A) ⇒ Unit): Unit

    Permalink
    Definition Classes
    Eventsourced
  50. def postRestart(reason: Throwable): Unit

    Permalink
    Definition Classes
    Actor
    Annotations
    @throws( classOf[java.lang.Exception] )
  51. def postStop(): Unit

    Permalink
    Definition Classes
    UnrestrictedStash → Actor
  52. def preRestart(reason: Throwable, message: Option[Any]): Unit

    Permalink
    Definition Classes
    UnrestrictedStash → Actor
  53. def preStart(): Unit

    Permalink
    Definition Classes
    Actor
    Annotations
    @throws( classOf[java.lang.Exception] )
  54. def receive: Receive

    Permalink
    Definition Classes
    PersistentActor → Actor
  55. final def receiveCommand: akka.actor.Actor.Receive

    Permalink
    Definition Classes
    AbstractOrchestrator → Eventsourced
  56. def receiveRecover: akka.actor.Actor.Receive

    Permalink
    Definition Classes
    AbstractOrchestrator → Eventsourced
  57. def recovery: Recovery

    Permalink
    Definition Classes
    PersistenceRecovery
  58. def recoveryFinished: Boolean

    Permalink
    Definition Classes
    Eventsourced
  59. def recoveryRunning: Boolean

    Permalink
    Definition Classes
    Eventsourced
  60. def redeliverInterval: FiniteDuration

    Permalink
    Definition Classes
    AtLeastOnceDeliveryLike
  61. def redeliveryBurstLimit: Int

    Permalink
    Definition Classes
    AtLeastOnceDeliveryLike
  62. final def restart(): Unit

    Permalink

    Will cause the orchestrator to restart.

    Will cause the orchestrator to restart. That is every task will become Unstarted and a StartReadyTasks will be sent to this orchestrator.

    Restart can only be invoked if all tasks have finished or a task caused an abort. If there is a task that is still waiting invoking this method will throw an exception.

  63. def saveSnapshot(snapshot: Any): Unit

    Permalink
    Definition Classes
    Snapshotter
  64. def saveSnapshotRoughlyEveryXMessages: Int

    Permalink

    Roughly every X messages a snapshot will be saved.

    Roughly every X messages a snapshot will be saved. Set to 0 to disable automatic saving of snapshots. By default this method returns the value defined in the configuration.

    This is just a rough value because the orchestrator will not save it in the snapshots. In fact it will not save it at all. Instead the value of lastSequenceNr will be used to estimate how many messages have been processed.

    You can trigger a save snapshot manually by sending a SaveSnapshot message to this orchestrator.

  65. implicit final val self: ActorRef

    Permalink
    Definition Classes
    Actor
  66. final def sender(): ActorRef

    Permalink
    Definition Classes
    Actor
  67. def setDeliverySnapshot(snapshot: AtLeastOnceDeliverySnapshot): Unit

    Permalink
    Definition Classes
    AtLeastOnceDeliveryLike
  68. val settings: Settings

    Permalink
  69. def snapshotPluginId: String

    Permalink
    Definition Classes
    PersistenceIdentity
  70. def snapshotSequenceNr: Long

    Permalink
    Definition Classes
    Eventsourced → Snapshotter
  71. def snapshotterId: String

    Permalink
    Definition Classes
    Eventsourced → Snapshotter
  72. def startTasks(): Unit

    Permalink

    User overridable callback.

    User overridable callback. Its called when recovery completes to start the Tasks. By default logs that the orchestrator started and sends it the StartReadyTasks message.

    You can override this to prevent the Orchestrator from starting right away. However that strategy will only be effective the first time the orchestrator starts, that is, if this orchestrator restarts with one task already finished, then that task will send the StartReadyTasks so that tasks that depend on it can start.

  73. def stash(): Unit

    Permalink
    Definition Classes
    StashSupport
  74. final def state: S

    Permalink
  75. final def state_=(state: S): Unit

    Permalink
  76. def supervisorStrategy: SupervisorStrategy

    Permalink
    Definition Classes
    Actor
  77. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  78. val taskColors: Vector[String]

    Permalink
  79. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  80. def unhandled(message: Any): Unit

    Permalink
    Definition Classes
    Eventsourced → Actor
  81. def unstashAll(): Unit

    Permalink
    Definition Classes
    Eventsourced → StashSupport
  82. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  83. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  84. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  85. def warnAfterNumberOfUnconfirmedAttempts: Int

    Permalink
    Definition Classes
    AtLeastOnceDeliveryLike
  86. def withLoggingPrefix(task: Task[_], message: ⇒ String): String

    Permalink

Deprecated Value Members

  1. def persist[A](events: Seq[A])(handler: (A) ⇒ Unit): Unit

    Permalink
    Definition Classes
    Eventsourced
    Annotations
    @deprecated
    Deprecated

    (Since version 2.4) use persistAll instead

  2. def persistAsync[A](events: Seq[A])(handler: (A) ⇒ Unit): Unit

    Permalink
    Definition Classes
    Eventsourced
    Annotations
    @deprecated
    Deprecated

    (Since version 2.4) use persistAllAsync instead

Inherited from IdImplicits

Inherited from ActorLogging

Inherited from AtLeastOnceDelivery

Inherited from AtLeastOnceDeliveryLike

Inherited from PersistentActor

Inherited from Eventsourced

Inherited from PersistenceRecovery

Inherited from PersistenceIdentity

Inherited from PersistenceStash

Inherited from StashFactory

Inherited from Stash

Inherited from UnrestrictedStash

Inherited from StashSupport

Inherited from Snapshotter

Inherited from Actor

Inherited from AnyRef

Inherited from Any

Ungrouped