EmbeddedWorkers class final
Queue worker and scheduler isolates started by Application.serveWith
(serve --embed-queue --embed-scheduler), so one process can serve HTTP,
process jobs and run the schedule without supervisord or cron.
Each role runs its own application in its own isolate, so a slow job never blocks the HTTP event loop. A crashed isolate is respawned with a growing delay; more than five crashes in a minute stop the respawning. stop asks each isolate to finish its current job or tick and waits up to the shutdown timeout before killing it.
Application.serveWith manages it; custom entrypoints can use it too.
Constructors
-
EmbeddedWorkers(ApplicationFactory factory, {required List<
EmbeddedRole> roles, required Logger logger, ScheduleCommandRunner? commandRunner, SendPort? coordinator})
Properties
- commandRunner ↔ ScheduleCommandRunner?
-
getter/setter pair
- coordinator → SendPort?
-
The server's coordinator (
Coordinator.listen()), so the embedded isolates share itsprocesscache store, rate limits and locks with the HTTP workers: a token a job revokes is refused by the server, a limit a scheduled task raises holds for the next request. Without it each isolate has a coordinator of its own.final - factory → ApplicationFactory
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- logger → Logger
-
final
-
roles
→ List<
EmbeddedRole> -
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
start(
) → Future< void> -
stop(
{Duration timeout = const Duration(seconds: 30)}) → Future< void> -
Asks every isolate to stop after its current job or tick; kills the
ones still running after
timeout. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited