Monitor your queues
You’ll turn on lifecycle events, run the GisilaRose dashboard to watch tasks and workers live, and forward failures to your own alerting.
Prerequisites
Section titled “Prerequisites”- Producers and workers on Redis.
1. Turn on events in every process
Section titled “1. Turn on events in every process”Events are off by default. With GisilaQueue.redis, pass events: true in producers and
workers:
import 'package:gisila_queue/gisila_queue.dart';
final app = GisilaQueue.redis(namespace: 'shop', events: true);When building components by hand, add events: RedisEventSink(prefix: 'shop').
WorkerCli.buildApp() does not add an event sink, so build the worker app yourself (see
Run workers).
2. Run the dashboard
Section titled “2. Run the dashboard”REDIS_URL=redis://:secret@localhost:6379/0 \ dart run gisila_queue:rose --namespace=shop --port=5555Open http://localhost:5555. You see recent tasks with state, args, result and timings,
workers with their counters and heartbeats, queue depths, and per-task-name stats. Fire,
retry, revoke, pause and resume are available because the binary opens a broker and a
control channel.
To expose it beyond localhost, require auth:
dart run gisila_queue:rose --namespace=shop --host=0.0.0.0 --basic-auth=admin:long-random-passwordRose refuses a public bind with write actions and no auth. --no-queues --no-control
makes it read-only.
3. Use the JSON API
Section titled “3. Use the JSON API”curl -u admin:pw localhost:5555/api/statscurl -u admin:pw 'localhost:5555/api/tasks?state=failure&limit=20'curl -u admin:pw -X POST -H 'Content-Type: application/json' \ -d '{"name":"health.ping"}' localhost:5555/api/tasks/firecurl -u admin:pw -X POST -H 'Content-Type: application/json' localhost:5555/api/queues/emails/pauseAll POSTs need Content-Type: application/json. See the
HTTP API table.
4. Check depths without Rose
Section titled “4. Check depths without Rose”dart run gisila_queue:gisila_queue inspect --namespace=shop --queues=default,emails,dead_letterAlert when dead_letter grows or a queue’s depth keeps rising.
5. Forward events to your own systems
Section titled “5. Forward events to your own systems”Implement QueueEventSink and combine it with
the Redis sink:
class AlertSink implements QueueEventSink { @override Future<void> emit(QueueEvent event) async { if (event.type != QueueEventType.taskFailed) return; try { await alerts.send('${event.taskName} ${event.taskId}: ${event.fields['error']}'); } catch (_) { // never throw from a sink } }
@override Future<void> close() async {}}
final app = GisilaQueue( broker: RedisBroker(prefix: 'shop'), backend: RedisResultBackend(prefix: 'shop'), events: MultiEventSink([RedisEventSink(prefix: 'shop'), AlertSink()]),);Or read the stream from a separate process with RedisEventSource(prefix: 'shop').events().
Verify it works
Section titled “Verify it works”Enqueue a task and watch it appear in Rose as pending, then started, then success.
Stop a worker and its status turns not alive about 30 seconds after its last heartbeat.