abstract class Task[R] extends AnyRef

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

The answer(s) to the sent message must be handled in behavior. behavior must invoke finish when no further processing is necessary. Or abort if the received message will prevent subsequent tasks from executing properly.

The pattern matching inside behavior must invoke matchId to ensure the received message is in fact the one that this task its waiting to receive.

The internal state of the orchestrator might be mutated inside behavior.

This class is very tightly coupled with Orchestrator and the reverse is also true. See AbstractOrchestrator for more details on why that is the case.

R

the return type of this Task.

Source
Task.scala
Linear Supertypes
Type Hierarchy
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Task
  2. AnyRef
  3. Any
Implicitly
  1. by any2stringadd
  2. by StringFormat
  3. by Ensuring
  4. by ArrowAssoc
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new Task(task: FullTask[R, _])

Abstract Value Members

  1. abstract def behavior: Receive

    The behavior of this task.

    The behavior of this task. This is akin to the receive method of an actor with the following exceptions: · An all catching pattern match is prohibited since it will cause the orchestrator to fail. · Every case must check if matchId returns true. This ensures the received message was in fact destined to this task. This choice of implementation allows the messages to have a free form, as it is the user that is responsible for extracting the id from the message. · Either finish or abort must be invoked after handling each response.

    Example of a well formed behavior:

    case Success(result, id) if matchId(id) =>
      orchestrator.state = // a new state
      finish("This task result") // The result is the value that the tasks that depend on this one will see.
    case SomethingWentWrong(why, id) if matchId(id) =>
      abort(why)
    case Timeout(id) =>
      abort(anError)
  2. abstract def createMessage(id: Long): Serializable

    The constructor of the message to be sent.

    The constructor of the message to be sent. It must always return the same message, only the id must be different. If this Task is to be used inside a TaskQuorum then the created message should also implement equals.

  3. abstract val destination: ActorPath

    The akka.actor.ActorPath to whom this task will send the message(s).

    The akka.actor.ActorPath to whom this task will send the message(s). This must be a value because the destination cannot change.

Concrete Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. def +(other: String): String
    Implicit
    This member is added by an implicit conversion from Task[R] to any2stringadd[Task[R]] performed by method any2stringadd in scala.Predef.
    Definition Classes
    any2stringadd
  4. def ->[B](y: B): (Task[R], B)
    Implicit
    This member is added by an implicit conversion from Task[R] to ArrowAssoc[Task[R]] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc
    Annotations
    @inline()
  5. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  6. final def abort(cause: Throwable): Unit

    Aborts this task, which implies:

    Aborts this task, which implies:

    1. This task will change its state to Aborted. 2. Every unstarted task that depends on this one will never be started. This will happen because a task can only start if its dependencies have finished. 3. Waiting tasks or tasks which do not have this task as a dependency will remain untouched, unless the orchestrator is stopped or context.become is invoked in the onTaskAbort/onAbort callbacks of the orchestrator. 4. The method onTaskAbort will be invoked in the orchestrator. 5. The method onFinish in the orchestrator will never be invoked since this task did not finish.

    Aborting an already aborted task will throw an exception.

    cause

    what caused the abort to be invoked.

  7. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  8. final def behaviorHandlingTimeout: Receive
  9. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )
  10. def ensuring(cond: (Task[R]) ⇒ Boolean, msg: ⇒ Any): Task[R]
    Implicit
    This member is added by an implicit conversion from Task[R] to Ensuring[Task[R]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  11. def ensuring(cond: (Task[R]) ⇒ Boolean): Task[R]
    Implicit
    This member is added by an implicit conversion from Task[R] to Ensuring[Task[R]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  12. def ensuring(cond: Boolean, msg: ⇒ Any): Task[R]
    Implicit
    This member is added by an implicit conversion from Task[R] to Ensuring[Task[R]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  13. def ensuring(cond: Boolean): Task[R]
    Implicit
    This member is added by an implicit conversion from Task[R] to Ensuring[Task[R]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  14. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  15. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  16. final def expectedID: Option[ID]
  17. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  18. final def finish(result: R): Unit

    Finishes this task, which implies:

    Finishes this task, which implies:

    1. This task will change its state to Finished. 2. Tasks that depend on this one will be started. 3. Re-sends from destination will no longer be handled by the orchestrator. If destinations re-sends its answer it will be logged as an unhandled message. 4. The method onTaskFinish will be invoked on the orchestrator.

    Finishing an already finished task will throw an exception.

    result

    the result this task will produce. This is the value that the tasks that depend on this one will see.

  19. def formatted(fmtstr: String): String
    Implicit
    This member is added by an implicit conversion from Task[R] to StringFormat[Task[R]] performed by method StringFormat in scala.Predef.
    Definition Classes
    StringFormat
    Annotations
    @inline()
  20. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  21. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  22. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  23. val log: LoggingAdapter
  24. final def matchId(id: Long): Boolean
  25. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  26. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  27. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  28. final def recoveryAwarePersist(event: Any)(handler: ⇒ Unit): Unit
  29. final def scheduleTimeout(id: ID): Unit
  30. final def start(): Unit
  31. final def state: State
  32. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  33. val task: FullTask[R, _]
  34. def toString(): String
    Definition Classes
    Task → AnyRef → Any
  35. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  36. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  37. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )
  38. final def withOrchestratorAndTaskPrefix(message: ⇒ String): String
  39. def [B](y: B): (Task[R], B)
    Implicit
    This member is added by an implicit conversion from Task[R] to ArrowAssoc[Task[R]] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc

Inherited from AnyRef

Inherited from Any

Inherited by implicit conversion any2stringadd from Task[R] to any2stringadd[Task[R]]

Inherited by implicit conversion StringFormat from Task[R] to StringFormat[Task[R]]

Inherited by implicit conversion Ensuring from Task[R] to Ensuring[Task[R]]

Inherited by implicit conversion ArrowAssoc from Task[R] to ArrowAssoc[Task[R]]

Ungrouped