Download the PHP package quellabs/canvas-scheduler-redis without Composer
On this page you can find all versions of the php package quellabs/canvas-scheduler-redis. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download quellabs/canvas-scheduler-redis
More information about quellabs/canvas-scheduler-redis
Files in quellabs/canvas-scheduler-redis
Package canvas-scheduler-redis
Short Description Redis queue consumer and job dispatcher for the Canvas PHP framework
License MIT
Homepage https://github.com/quellabs/canvas-redis
Informations about the package canvas-scheduler-redis
canvas-redis
Redis queue consumer and job dispatcher for the Canvas PHP framework.
Adds a Redis-backed job queue to Canvas's Task Scheduler system. Jobs are dispatched from application code via dependency injection and processed by a long-running worker process.
Requirements
- PHP 8.2+
- Canvas 1.x
- Redis server
- Predis (installed automatically)
Installation
No further configuration is required. The package registers itself automatically via Canvas's service discovery.
Configuration
Set the default queue driver in config/app.php:
This tells Canvas to inject RedisQueue by default when QueueInterface is requested. If you only have one queue
package installed, this can be omitted.
To request a specific driver regardless of the default, use contextual DI:
Redis-specific settings go in config/scheduler-redis.php:
Creating a Job
Implement QueueableInterface on any class. Constructor parameters become the serializable payload:
Payload keys must match constructor parameter names exactly — the worker reconstructs the job via Canvas's DI container
using make($class, $payload).
getTimeout() returns the maximum number of seconds the job is expected to run. This value is stored in the job
envelope for observability but is not enforced by the worker itself. To enforce it, set stopwaitsecs in your
Supervisord configuration to the longest expected job duration across all job types (see below).
Dispatching Jobs
Inject QueueInterface into any controller or service:
The job is pushed onto the Redis list immediately and processed by the worker when it is next available.
Running the Worker
Start the worker via Sculpt:
The worker processes jobs until it reaches the configured queue_max_jobs limit (default: 500), then exits cleanly.
Use Supervisord to keep it running:
stopwaitsecs should be set to the longest expected job duration across all job types. Supervisord will send SIGKILL
to any worker that has not stopped within this window after receiving SIGTERM.
Restart workers after deployment so they pick up new code:
Retry and Failure Handling
Failed jobs are retried up to getMaxRetries() times. Each retry increments the attempt counter and requeues the job.
Jobs that exhaust all retries are moved to a failed list in Redis at {prefix}:failed:{name}, for example:
Redis Key Layout
| Key | Purpose |
|---|---|
{prefix}:queue:{name} |
Pending jobs |
{prefix}:failed:{name} |
Failed jobs |
{prefix}:reserved:{name}:{id} |
Currently executing job |
License
MIT
All versions of canvas-scheduler-redis with dependencies
quellabs/canvas Version ^1.
quellabs/contracts Version ^1.
quellabs/dependency-injection Version ^1.
quellabs/support Version ^1.