WorkerCli class
Shared setup for a bin/worker.dart entrypoint — parses the standard
gisila_queue worker flags, builds a Redis-backed GisilaQueue, and
wires graceful shutdown, so a project's own binary can be little more
than:
Future<void> main(List<String> argv) async {
final cli = WorkerCli.parse(argv);
if (cli.help) return print(cli.usage);
final app = cli.buildApp();
registerMyTasks(app); // your own task registrations
await cli.run(app);
}
Recognized flags: --queues=a,b (default: default),
--concurrency=N (default: 1), --redis-host=H (default: localhost),
--redis-port=P (default: 6379), --prefix=P (default: gq),
--loglevel=debug|info|warning|error (default: info), --help/-h.
Constructors
-
WorkerCli.parse(List<
String> argv) -
factory
Properties
- args → CliArgs
-
final
- concurrency → int
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- help → bool
-
no setter
- logLevel → LogLevel
-
final
- prefix → String
-
final
-
queues
→ List<
String> -
final
- redisHost → String
-
final
- redisPort → int
-
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
buildApp(
) → GisilaQueue - Builds a Redis-backed GisilaQueue from the parsed flags. Register your own tasks on the result before calling run.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
run(
GisilaQueue app) → Future< void> -
Builds a Worker for
appfrom the parsed flags, starts it, prints a startup banner, and blocks until aSIGINT/SIGTERMtriggers a graceful Worker.stop. Also closesapp's broker/backend/control channel connections before returning, so the process actually exits instead of hanging on an open Redis socket. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited