Search by

iteearmah / laravel-remote-jobs

HTTP endpoints that let a Node.js worker claim and execute Laravel queued jobs from the standard jobs table.

Maintainers

Package info

github.com/iteearmah/laravel-remote-jobs

pkg:composer/iteearmah/laravel-remote-jobs

Transparency log

Statistics

Installs: 2

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.0 2026-08-31 00:00 UTC

This package is auto-updated.

Last update: 2026-08-31 01:42:17 UTC


README

HTTP endpoints that let a Node.js worker claim and execute Laravel queued jobs from the standard jobs table (the database queue connection). No custom queue driver is needed — the package is the backend for the laravel-jobs-runner Node.js worker.

Installation

composer require iteearmah/laravel-remote-jobs

The service provider is auto-discovered. Publish the config (optional):

php artisan vendor:publish --tag=remote-jobs-config

Configuration

Set these in the consuming app's .env:

Variable Default Description
REMOTE_WORKER_TOKEN Shared secret the worker must present
REMOTE_RETRY_AFTER 90 Seconds before a reserved job is considered stale
REMOTE_MAX_TRIES 3 Default max attempts before a job is failed
REMOTE_BACKOFF 10 Default backoff (seconds) between retries

Endpoints

All under /api/remote-jobs, authenticated with the X-Remote-Worker-Token header:

  • POST /next — atomically claims the next pending job (sets reserved_at, increments attempts).
  • POST /execute — runs the job's handle() via the Bus dispatcher; deletes the row on success, retries with backoff, or moves the job to failed_jobs when attempts run out.
  • POST /release — returns a claimed job to the queue (worker timeout path).

Requirements

  • The app must have the standard jobs and failed_jobs tables (default Laravel migrations).
  • Dispatch jobs with ->onConnection('database') (or set QUEUE_CONNECTION=database).
  • Do not run php artisan queue:work — the Node.js worker is the only consumer.

Testing

php artisan remote-job:test

Dispatches a TestJob to the database queue so you can watch the Node.js worker process it.