quillmark
Durable background work without a separate broker.
quillmark is a job queue that stores work in Postgres. It gives you at-least-once delivery, scheduled jobs and retries without running a separate message broker.
go get codeberg.org/quillmarkhq/quillmark@latest
Example
package main
import (
"context"
"fmt"
"log"
"time"
"codeberg.org/quillmarkhq/quillmark"
)
func main() {
ctx := context.Background()
q, err := quillmark.New(quillmark.Options{
DatabaseURL: "postgres://localhost/app",
Concurrency: 10,
})
if err != nil {
log.Fatal(err)
}
defer q.Close()
n, err := q.Enqueue(ctx, "send_email", []byte("{"to":"ada@example.com"}"))
if err != nil {
log.Fatal(err)
}
fmt.Println(n)
n, err := q.Schedule(ctx, "cleanup", 30 * time.Second)
if err != nil {
log.Fatal(err)
}
fmt.Println(n)
}
Features
- Scheduled jobs. Run a job at a specific time or after a delay. No cron daemon required.
- Priorities. Urgent jobs jump the line without starving the rest.
- Graceful shutdown. Workers finish what they started before the process exits.
- Inspectable. Jobs are rows. Query them with SQL when something looks wrong.
- Unique jobs. Deduplicate by key so that the same work is not enqueued twice.
- Transactional enqueue. Insert a job in the same transaction as the row it refers to. If the transaction rolls back, the job never existed.