What this prompt does
This prompt casts the model as a senior Laravel engineer and asks for working config files and a real job class rather than pseudocode. It defines five deliverables: a config/horizon.php with supervisors mapped to your queues, with sensible processes, balance strategy, and per-queue priorities for local and production, an example job implementing retryUntil or backoff with tries and timeout set deliberately, a RateLimited middleware on the job plus the limiter definition so a fragile downstream API is not hammered, failure handling using the failed_jobs table, the failed() hook, and an alert to your channel, and the supervisor command to keep Horizon running plus how to monitor throughput and wait times. The structure works because it sets retries, backoff, and failure alerts together, so the silent failures get surfaced.
Four variables drive it. [queues] names the queues — default, emails, exports — that supervisors map to. [driver] describes the infra, like Redis on a single worker host. [alert_channel] sets where failures notify, such as Slack #alerts. [job_purpose] describes what the example job does, like syncing contacts to a rate-limited CRM API, which shapes the RateLimited middleware. The advice to set timeout below your retryUntil window is the load-bearing part: get that wrong and jobs stack up faster than they clear, turning a transient hiccup into a growing backlog you don't notice until users do.
When to use it
- You run Laravel queues with Horizon and want supervisors, retries, and alerts configured together.
- A fragile downstream API needs rate limiting so jobs don't hammer it into failure.
- Silent failures — a job retrying forever or a backlog building — are a real risk.
- You want per-queue priorities and a balance strategy for both local and production.
- Failure alerts to a channel like Slack matter so you hear about problems before users.
- You need a real job class showing retryUntil or backoff, tries, and timeout set deliberately.
Example output
Expect each config and PHP file in its own fenced block headed by its path. A config/horizon.php maps supervisors to [queues] with sensible processes, a balance strategy, and per-queue priorities for local and production over [driver]; an example job implements retryUntil or backoff with tries and timeout reasoned about; a RateLimited middleware plus limiter definition protects the API behind [job_purpose]; failure handling uses the failed_jobs table, the failed() hook, and an alert to [alert_channel]; and the supervisor command keeps Horizon running with notes on monitoring throughput and wait times. It is buildable configuration, not pseudocode.
Pro tips
- List your real
[queues]so supervisors and per-queue priorities map to how your workload actually splits. - Describe
[driver]accurately, since processes and balance strategy depend on your Redis and worker setup. - Set
[job_purpose]to the real downstream so the RateLimited middleware matches that API's limits. - Point
[alert_channel]at a channel you actually watch so failure notifications reach someone. - Set timeout below your retryUntil window, or jobs stack up faster than they clear.
- Configure retries, backoff, and alerts together so silent failures surface before users feel them.