← Webalkalmazás-alapok · projekttervezési csomag adatlapja

Skill · 1.0.0 verzió

Laravel-sorok és események

Kifejezett újrapróbálással és tiszta ügyfélhatárokkal szervezi a háttérmunkát.

laravel-queues-events

Ezt a skillt használó ügynökök

Nézd meg, miben segít

Mikor hasznos?

Akkor használd, ha exportot vagy integrációt a kérés életciklusán kívül futtatsz.

Miben segít neked?

  • Ismétlésbiztos feladatot és korlátos időtúllépést tervez.
  • Commit után indít függő munkát, kezeli a közben megváltozott rekordot.
  • Megakadályozza, hogy a worker másik feladatba vigye az ügyfélállapotot.

Például ezt kérheted

Készíts dupla kézbesítést és workerújraindítást kezelő exportot követhető hibaállapottal és ügyfélelkülönítéssel. Ugyanabban a feldolgozóban egymás után exportálj két szervezetnek, majd ismételj feladatot. Feladatonként egy megfelelő fájl készüljön, korábbi szervezeti kontextus nélkül.

Részletes dokumentáció

Itt a skill eredeti útmutatóját, példáit és ellenőrzési szempontjait olvashatod az eredeti nyelven.

Részletek…Összecsukás

Queues, Events & Scheduler

Queued jobs, retries and idempotency

  • Offload slow or external work (emails, webhooks, third-party APIs, exports, media processing) to ShouldQueue jobs. Never treat a queued job or event listener as guaranteed to run exactly once.
  • Make every job idempotent: guard side effects with state checks, unique database constraints, idempotency keys or ShouldBeUnique, so retries or duplicate dispatches never double-charge, double-send or corrupt records.
  • Set explicit $tries, $backoff (array of seconds), $timeout and $maxExceptions, and implement failed(\Throwable $e) to record permanent failure and clean up partial state.
  • Ensure the queue connection's retry_after in config/queue.php is strictly greater than the job's $timeout; otherwise a worker can pick up a second copy while the first is still running.

Payloads, transactions and worker state

  • Pass Eloquent models (via SerializesModels, which stores only the model identifier and re-queries on execution) or scalar IDs — never serialize large collections, request objects or binary blobs into the queue payload. Handle deleted or stale models cleanly when the job runs.
  • When dispatching a job or event inside a database transaction (or from a model observer), implement ShouldDispatchAfterCommit or call ->afterCommit() so workers never read uncommitted rows.
  • In long-lived queue workers (queue:work, Horizon, Octane), never leak static state, singleton properties, auth state or tenant context from one job or request into the next. Explicitly pass and restore tenant context per job, and note when a deploy requires php artisan queue:restart.

Events, notifications and scheduler

  • Use Events and Listeners to decouple domain side effects from the primary action, and Notifications (ShouldQueue) for user-facing messages across mail, database or Slack channels.
  • Keep scheduled closures/commands in routes/console.php (or app/Console/Kernel.php in Laravel 10) thin by delegating to services or jobs. Add ->withoutOverlapping() on tasks that could run past their interval and ->onOneServer() in multi-server deployments.

Csomagban lévő fájlok 2

  • LICENSE.txt
  • SKILL.md