cd ~/projects/workerbox
A Go-based background job processing system with concurrent workers, automatic retries, and dead-letter queue management.
WorkerBox is a background job processing system written in Go. Work is added as jobs, picked up by a pool of concurrent workers, and processed away from the main application.
It is built to handle failure: jobs that fail are retried automatically, and the ones that keep failing end up in a dead-letter queue you can manage. GORM and PostgreSQL are used for storage.
// what WorkerBox is built withpackage stack var Stack = map[string][]string{"language": {"Golang"},"processing": {"Concurrency", "Mutex", "Queues", "Worker Pool", "Retries"},"database": {"GORM", "PostgreSQL"},}A job is added to the queue, along with whatever it needs to run.
Several workers run concurrently, so many jobs can be processed at the same time.
If a job fails, it is retried automatically instead of being dropped.
Jobs that keep failing are moved to a dead-letter queue, where they can be inspected and managed.
Jobs are processed by several workers at the same time, so one slow job does not hold up the rest.
When a job fails it is retried automatically, so temporary errors do not need manual attention.
Jobs that keep failing are set aside in a dead-letter queue, where they can be inspected and managed later.
Problem: A job that fails once should not silently disappear.
Solution: Retry it automatically, and move it to a dead-letter queue if it keeps failing.
Problem: Processing jobs one at a time makes everything wait on the slowest one.
Solution: Run a pool of concurrent workers so jobs are processed in parallel.