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
- Alphabetic
- By Inheritance
- Task
- AnyRef
- Any
- by any2stringadd
- by StringFormat
- by Ensuring
- by ArrowAssoc
- Hide All
- Show All
- Public
- All
Abstract Value Members
-
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 theid
from the message. · Eitherfinish
orabort
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)
-
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
. -
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
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
- def +(other: String): String
- def ->[B](y: B): (Task[R], B)
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
abort(cause: Throwable): Unit
Aborts this task, which implies:
Aborts this task, which implies:
- 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 orcontext.become
is invoked in theonTaskAbort
/onAbort
callbacks of the orchestrator. 4. The methodonTaskAbort
will be invoked in the orchestrator. 5. The methodonFinish
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.
- This task will change its state to
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
- final def behaviorHandlingTimeout: Receive
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
- def ensuring(cond: (Task[R]) ⇒ Boolean, msg: ⇒ Any): Task[R]
- def ensuring(cond: (Task[R]) ⇒ Boolean): Task[R]
- def ensuring(cond: Boolean, msg: ⇒ Any): Task[R]
- def ensuring(cond: Boolean): Task[R]
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def expectedID: Option[ID]
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
finish(result: R): Unit
Finishes this task, which implies:
Finishes this task, which implies:
- This task will change its state to
Finished
. 2. Tasks that depend on this one will be started. 3. Re-sends fromdestination
will no longer be handled by the orchestrator. If destinations re-sends its answer it will be logged as an unhandled message. 4. The methodonTaskFinish
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.
- This task will change its state to
- def formatted(fmtstr: String): String
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- val log: LoggingAdapter
- final def matchId(id: Long): Boolean
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def recoveryAwarePersist(event: Any)(handler: ⇒ Unit): Unit
- final def scheduleTimeout(id: ID): Unit
- final def start(): Unit
- final def state: State
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
- val task: FullTask[R, _]
-
def
toString(): String
- Definition Classes
- Task → AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
- final def withOrchestratorAndTaskPrefix(message: ⇒ String): String
- def →[B](y: B): (Task[R], B)