taskq queues background jobs in Go with pluggable Redis, SQS, IronMQ, or in-memory backends. Producers enqueue named tasks; consumers run registered handlers.
Overview
taskq is a Go package for asynchronous tasks and job queues. You register task handlers, attach them to named queues, enqueue work from producers, and run consumers that fetch and execute messages.
Backend drivers include Redis, Amazon SQS, IronMQ, and an in-memory option for tests or simple setups. The library scales goroutines used to fetch and process messages, supports global rate limits and worker caps, and can deduplicate messages that share the same name.
Failed work can retry with exponential backoff; when every message in a queue fails, processing can pause automatically. Optional fallback handlers deal with permanently failed messages. Batching and Snappy or S2 compression apply on backends that support them.
OpenTelemetry instrumentation is documented for monitoring throughput and errors. The API follows familiar producer–consumer patterns: create a queue from a factory, register tasks with handlers, add jobs with context, and start the consumer loop.
Key features
- Redis, SQS, IronMQ, in-memory backends
- Auto-scaling fetch and worker goroutines
- Global rate limiting and worker limits
- Message deduplication by name
- Exponential backoff retries
- Failed-queue pause and fallback handlers
- Message batching on supported backends
- Snappy and S2 message compression
Use cases
- Background job processing in Go services
- Decoupled API work via Redis queues
- AWS SQS-backed worker pipelines
- In-memory queue testing