Skip to content

gisila_queue

gisila_queue runs work in the background. You register named tasks, enqueue them from anywhere with .delay() or .applyAsync(), and worker processes run them. A broker (Redis, RabbitMQ or in-memory) carries the messages, and an optional result backend stores each task’s state and return value. If you know Celery, you already know the shape.

Alongside the core it has retries with exponential backoff, countdown/ETA and expiry, named queues with routing, periodic tasks (beat) with leader election, chain/group/chord workflows, revocation and queue pause, deduplication, and an optional web dashboard (GisilaRose).

This section also covers gisila_redis, a small separate package that gives gisila web apps a Redis-backed rate-limit store and cache.

dependencies:
gisila_queue: ^0.3.0
import 'dart:async';
import 'package:gisila_queue/gisila_queue.dart';
Future<void> main() async {
final app = GisilaQueue(broker: InMemoryBroker(), backend: InMemoryResultBackend());
final add = app.task<int>(
'math.add',
(ctx) async => (ctx.arg(0) as int) + (ctx.arg(1) as int),
maxRetries: 3,
);
final worker = app.worker(concurrency: 4);
unawaited(worker.run());
final r = await add.delay([2, 3]);
print(await r.get()); // 5
await worker.stop();
await app.close();
}
  • Work that would slow a request down: email, PDFs, image processing, third-party APIs.
  • Work that must survive crashes and deploys: Redis and RabbitMQ give at-least-once delivery.
  • Work that runs later or on a schedule: countdown, eta, and beat with cron expressions.
  • Spreading load across processes and machines.
  • Fast work you must finish before responding: just await it.
  • Event streaming with replay or consumer groups: use a log such as Kafka or Redis Streams; queue messages are consumed once.
  • Exactly-once side effects with no way to make the handler idempotent: tasks can run more than once (see Delivery guarantees).