Monolith Job Development
Use this skill when
- •Adding new async work to
app/jobs/. - •Updating queue handlers or job scheduling behavior.
Fast path
Run: make generator job <Name>
This typically:
- •creates
app/jobs/<name>_job.go - •creates matching test file
- •adds job type constant in
app/models/job.go - •registers handler in
app/jobs/job_queue.go
Runtime architecture
- •Queue initialized via
jobs.InitJobQueue()inmain.go. - •Worker count controlled by
config.JOB_QUEUE_NUM_WORKERS. - •Jobs are typed via
models.JobType*enums and payload bytes.
Implementation workflow
- •Define payload struct and marshal/unmarshal strategy.
- •Implement generated job handler body.
- •Register handler (generator usually does this).
- •Enqueue from controller/service as needed.
- •Add focused tests for decoding + handler behavior.
Reliability tips
- •Keep handlers idempotent where possible.
- •Log failures with useful context.
- •Treat malformed payloads as explicit errors.