perago
perago is Laravel Queues for Go. A job is a struct with a Handle(ctx) error method. You dispatch it to a connection, and a worker runs it with Laravel’s semantics: tries, backoff, timeouts, middleware, unique and encrypted jobs, chains, batches, failed jobs, events, queue:* commands and test fakes.
The database driver and stores need nothing but database/sql, so they work on PostgreSQL, CockroachDB, Redshift, MySQL, MariaDB, SQLite, SQL Server and Oracle with any driver. perago works with migro through an optional module and never requires it (Using with migro). Redis, Amazon SQS and Beanstalkd have their own drivers, each in its own module, so the core has no dependencies.
type SendWelcome struct {
perago.Queueable
UserID int
}
func init() { perago.Register(&SendWelcome{}) }
func (j *SendWelcome) Handle(ctx context.Context) error { return mailer.Welcome(ctx, j.UserID) }
m.Dispatch(&SendWelcome{UserID: 42}).Delay(time.Minute).Send(ctx)
Where to go next
| You want to | Read |
|---|---|
| Install perago and run your first worker | Getting started |
| Pick and configure a backend | Connections and drivers |
| Use perago on a migro project (optional) | Using with migro |
| Write jobs: tries, backoff, unique, encrypted, models | Jobs |
| Wrap jobs: rate limits, overlap locks, throttling | Job middleware |
| Dispatch: delays, sync, after commit, routing | Dispatching |
| Run jobs in sequence or as a tracked group | Chains and Batches |
| Run and deploy workers | Workers |
| Inspect and retry failures | Failed jobs |
| Hook into the lifecycle, watch queue sizes | Events and monitoring |
| Test code that dispatches | Testing |
| Look up a command | Command line |
| Translate Laravel code | Coming from Laravel |