class TaskQuorum[R] extends TaskSpawnOrchestrator[R, Quorum[R]]
A task that creates a variable number of tasks and succeeds when n
tasks finish producing the same result.
n
is calculated with the minimumVotes function.
The return type and the message of the tasks must be the same. And their destinations must be different.
The last two restrictions are validated in runtime when the quorum is created. If they fail the task will abort.
To validate the messages are the same, each task message is compared via !=
against the other tasks messages.
- Source
- TaskQuorum.scala
- Alphabetic
- By Inheritance
- TaskQuorum
- TaskSpawnOrchestrator
- Task
- AnyRef
- Any
- by any2stringadd
- by StringFormat
- by Ensuring
- by ArrowAssoc
- Hide All
- Show All
- Public
- All
Instance Constructors
- new TaskQuorum(task: FullTask[R, _])(minimumVotes: MinimumVotes, taskBuilders: Iterable[TaskBuilder[R]])
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
def
+(other: String): String
- Implicit
- This member is added by an implicit conversion from TaskQuorum[R] to any2stringadd[TaskQuorum[R]] performed by method any2stringadd in scala.Predef.
- Definition Classes
- any2stringadd
-
def
->[B](y: B): (TaskQuorum[R], B)
- Implicit
- This member is added by an implicit conversion from TaskQuorum[R] to ArrowAssoc[TaskQuorum[R]] performed by method ArrowAssoc in scala.Predef.
- Definition Classes
- ArrowAssoc
- Annotations
- @inline()
-
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.
- Definition Classes
- Task
- This task will change its state to
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
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)
- Definition Classes
- TaskSpawnOrchestrator → Task
-
final
def
behaviorHandlingTimeout: Receive
- Definition Classes
- Task
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
-
final
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
.- Definition Classes
- TaskSpawnOrchestrator → Task
-
final
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.
- Definition Classes
- TaskSpawnOrchestrator → Task
-
def
ensuring(cond: (TaskQuorum[R]) ⇒ Boolean, msg: ⇒ Any): TaskQuorum[R]
- Implicit
- This member is added by an implicit conversion from TaskQuorum[R] to Ensuring[TaskQuorum[R]] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
-
def
ensuring(cond: (TaskQuorum[R]) ⇒ Boolean): TaskQuorum[R]
- Implicit
- This member is added by an implicit conversion from TaskQuorum[R] to Ensuring[TaskQuorum[R]] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
-
def
ensuring(cond: Boolean, msg: ⇒ Any): TaskQuorum[R]
- Implicit
- This member is added by an implicit conversion from TaskQuorum[R] to Ensuring[TaskQuorum[R]] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
-
def
ensuring(cond: Boolean): TaskQuorum[R]
- Implicit
- This member is added by an implicit conversion from TaskQuorum[R] to Ensuring[TaskQuorum[R]] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
expectedID: Option[ID]
- Definition Classes
- Task
-
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.
- Definition Classes
- Task
- This task will change its state to
-
def
formatted(fmtstr: String): String
- Implicit
- This member is added by an implicit conversion from TaskQuorum[R] to StringFormat[TaskQuorum[R]] performed by method StringFormat in scala.Predef.
- Definition Classes
- StringFormat
- Annotations
- @inline()
-
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
- Definition Classes
- Task
-
final
def
matchId(id: Long): Boolean
- Definition Classes
- Task
-
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
- Definition Classes
- Task
-
final
def
scheduleTimeout(id: ID): Unit
- Definition Classes
- Task
-
final
val
spawner: ActorRef
- Definition Classes
- TaskSpawnOrchestrator
-
final
def
start(): Unit
- Definition Classes
- Task
-
final
def
state: State
- Definition Classes
- Task
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
val
task: FullTask[R, _]
- Definition Classes
- Task
-
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
- Definition Classes
- Task
-
def
→[B](y: B): (TaskQuorum[R], B)
- Implicit
- This member is added by an implicit conversion from TaskQuorum[R] to ArrowAssoc[TaskQuorum[R]] performed by method ArrowAssoc in scala.Predef.
- Definition Classes
- ArrowAssoc