Implement background jobs with queues, workers, batches, chains, middleware, and failure handling. Use when processing async tasks or handling long-running operations.
From fuse-laravelnpx claudepluginhub fusengine/agents --plugin fuse-laravelThis skill uses the workspace's default tool permissions.
references/batching.mdreferences/chaining.mdreferences/dispatching.mdreferences/failed-jobs.mdreferences/horizon.mdreferences/jobs.mdreferences/middleware.mdreferences/templates/BatchJob.php.mdreferences/templates/ChainedJobs.php.mdreferences/templates/JobMiddleware.php.mdreferences/templates/JobTest.php.mdreferences/templates/QueueableJob.php.mdreferences/testing.mdreferences/troubleshooting.mdreferences/workers.mdProvides UI/UX resources: 50+ styles, color palettes, font pairings, guidelines, charts for web/mobile across React, Next.js, Vue, Svelte, Tailwind, React Native, Flutter. Aids planning, building, reviewing interfaces.
Fetches up-to-date documentation from Context7 for libraries and frameworks like React, Next.js, Prisma. Use for setup questions, API references, and code examples.
Fetches up-to-date documentation from Context7 for libraries and frameworks like React, Next.js, Prisma. Use for setup questions, API references, and code examples.
Before ANY implementation, use TeamCreate to spawn 3 agents:
After implementation, run fuse-ai-pilot:sniper for validation.
| Component | Purpose |
|---|---|
| Jobs | Background tasks with retries, timeouts |
| Workers | Process jobs from queues |
| Batches | Group jobs with progress tracking |
| Chains | Sequential job execution |
| Middleware | Rate limiting, deduplication |
| Horizon | Redis queue monitoring dashboard |
Which driver?
├── Development → sync (instant execution)
├── Small app → database (simple, no Redis)
├── Production → redis (fast, Horizon support)
├── AWS → sqs (managed, scalable)
└── High volume → redis + Horizon (monitoring)
Job type?
├── Simple async → Standard Job
├── Group processing → Batch (progress, cancel)
├── Sequential steps → Chain (A → B → C)
├── Rate limited → Middleware + RateLimiter
├── Unique execution → UniqueJob / WithoutOverlapping
└── Long running → Timeout + Retry settings
| Topic | Reference | When to Consult |
|---|---|---|
| Jobs | jobs.md | Creating job classes |
| Dispatching | dispatching.md | Sending jobs to queues |
| Workers | workers.md | Running queue workers |
| Batching | batching.md | Grouping jobs |
| Chaining | chaining.md | Sequential jobs |
| Middleware | middleware.md | Rate limiting, dedup |
| Failed Jobs | failed-jobs.md | Error handling |
| Horizon | horizon.md | Monitoring dashboard |
| Testing | testing.md | Job testing |
| Troubleshooting | troubleshooting.md | Common issues |
| Template | When to Use |
|---|---|
| QueueableJob.php.md | Standard job with retries |
| BatchJob.php.md | Batchable job |
| ChainedJobs.php.md | Job chain implementation |
| JobMiddleware.php.md | Custom middleware |
| JobTest.php.md | Testing jobs |
final class ProcessOrder implements ShouldQueue
{
use Queueable;
public int $tries = 3;
public int $backoff = 60;
public int $timeout = 120;
public function __construct(
public readonly Order $order,
) {}
public function handle(OrderService $service): void
{
$service->process($this->order);
}
public function failed(\Throwable $e): void
{
Log::error('Order failed', ['id' => $this->order->id]);
}
}
// Immediate
ProcessOrder::dispatch($order);
// Delayed
ProcessOrder::dispatch($order)->delay(now()->addMinutes(5));
// On specific queue
ProcessOrder::dispatch($order)->onQueue('orders');
final for job classesfailed() methodtimeout valuesUnique for one-at-a-time jobsafterCommit)