-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Mauricio Gomes edited this page Jan 3, 2026
·
4 revisions
Senna is a background job processing library for Go, backed by Redis or Valkey. It provides reliable job queuing, scheduling, retries, rate limiting, and batch processing with a clean, middleware-based architecture.
- Redis 6.2+
- Valkey 7.2+
Both backends are fully supported and tested.
| Feature | Description |
|---|---|
| Persistent Queues | Jobs are stored in Redis/Valkey and survive restarts |
| Scheduled Jobs | Run jobs at a specific time or after a delay |
| Automatic Retries | Configurable exponential backoff with dead letter queue |
| Priority Queues | Multiple queues with weighted priority distribution |
| Rate Limiting | 5 distributed algorithms: bucket, sliding window, leaky bucket, concurrent, points |
| Batch Processing | Group jobs and get callbacks on completion |
| Periodic Jobs | Cron-based scheduling with distributed coordination |
| Encryption | AES-GCM encryption for sensitive job arguments |
| Unique Jobs | Prevent duplicate jobs with deduplication keys |
| Middleware | Extensible middleware pattern for cross-cutting concerns |
| Graceful Shutdown | Wait for in-flight jobs to complete |
go get github.com/mgomes/sennaEnqueue a job:
c, _ := client.New(&client.Config{
Redis: senna.RedisConfig{Addr: "localhost:6379"},
Namespace: "myapp",
})
c.Enqueue(ctx, "send_email", map[string]any{
"to": "user@example.com",
"subject": "Welcome!",
})Process jobs:
w, _ := worker.New(&worker.Config{
Redis: senna.RedisConfig{Addr: "localhost:6379"},
Namespace: "myapp",
Settings: senna.WorkerSettings{Concurrency: 10},
})
w.Register("send_email", func(ctx context.Context, job *senna.Job) error {
to := job.Args["to"].(string)
// send email...
return nil
})
w.Run(ctx)- Getting Started - Installation, setup, and your first job
- Enqueuing Jobs - Client API and job options
- Workers - Worker configuration and handlers
- Queues - Queue management and priorities
- Batches - Group jobs with completion callbacks
- Rate Limiters - Distributed rate limiting
- Periodic Jobs - Cron-based scheduling
- Middleware - Built-in and custom middleware
- Error Handling - Retries and dead letter queue