Download the PHP package goletter/hyperf-queue without Composer
On this page you can find all versions of the php package goletter/hyperf-queue. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download goletter/hyperf-queue
More information about goletter/hyperf-queue
Files in goletter/hyperf-queue
Package hyperf-queue
Short Description Millisecond-precision async queue driver for Hyperf, compatible with hyperf/async-queue.
License MIT
Informations about the package hyperf-queue
goletter/hyperf-queue
Millisecond-precision async queue for Hyperf, built on top of hyperf/async-queue.
Official RedisDriver stores delay scores with time() (second precision). This package provides RedisMsDriver that:
- stores delayed / reserved scores in milliseconds
- exposes
pushMs()/Queue::laterMs()/dispatch_ms() - runs a lightweight mover coroutine (default every 5ms) so due jobs are pushed into
waitingwithout waiting forBRPOPtimeout - uses a Lua script to move due jobs atomically (safe under multiple consumers)
Requirements
- PHP >= 8.1
- Hyperf 3.1.x
hyperf/async-queue- Redis
Install
Path repository (monorepo):
Publish config (or merge into existing config/autoload/async_queue.php):
Configuration
Keep the official default pool unchanged, and add a separate ms pool:
The ms pool uses the same keys as the official pool. Optional tuning keys:
- Official jobs: existing
AsyncQueueConsumer(defaultpool) - Millisecond jobs: package process
Goletter\Queue\Process\MsQueueConsumer(mspool, auto-registered via#[Process])
Usage
Convention: on RedisMsDriver (ms pool), DriverInterface::push($job, $delay) treats $delay as milliseconds, so existing QueueService::push($job, 'ms', 10) works without API changes. On official RedisDriver, $delay remains seconds.
Jobs are normal Hyperf\AsyncQueue\Job classes — no special base class required.
Ops
Production notes
- Do not share
channelbetweenRedisDriverandRedisMsDriver. Score units differ (seconds vs milliseconds). - Prefer Redis Cluster hash tags in channel names, e.g.
{queue-ms}, so related keys stay in one slot. move_interval_mstrades CPU vs delay accuracy.5is a good default (typical wake latency ≈ 5–20ms + Redis RTT).- On
mspool,push($job, $delay)delay unit is milliseconds; ondefaultit is seconds. - Retry after failure uses
retry_seconds(converted to ms), orretry_millisecondsif set. - Multi-tenant: put
tenantIdon the Job and restore context inhandle(); rate-limit at push time if needed.
How it works
License
MIT
All versions of hyperf-queue with dependencies
hyperf/async-queue Version ~3.1.0
hyperf/codec Version ~3.1.0
hyperf/collection Version ~3.1.0
hyperf/command Version ~3.1.0
hyperf/context Version ~3.1.0
hyperf/contract Version ~3.1.0
hyperf/coroutine Version ~3.1.0
hyperf/process Version ~3.1.0
hyperf/redis Version ~3.1.0
hyperf/support Version ~3.1.0
psr/container Version ^1.0 || ^2.0