Repository navigation
5.0.1
Queue 5 separates processing concurrency from prefetch:
$server->job('stats-usage', coroutines: 1, prefetch: 100);Prefetch limits all unacknowledged messages, including waiting work and pending confirmations. It defaults to the coroutine count and cannot be lower. Redis groups reservations, completions, and heartbeats while retaining existing opaque list payloads. NATS batches independent acknowledgement requests with a server confirmation for every message. Shutdown returns prefetched work whose handler never started.
Synchronous publishers now consistently use publish() and publishMany(). enqueue() remains the background handoff API. Rename enqueueMany() callers and custom synchronous publisher implementations to publishMany().
This release supersedes the withdrawn 5.0.0 release.
Upgrade notes
- Rename
maxCoroutines/batchnamed arguments and adapter queue-spec keys tocoroutines/prefetch. Positional argument order is unchanged. ReplaceServer::batch()withServer::prefetch(). - Priority publishing and consumption are removed. Existing normal NATS subjects and Redis ready payloads are unchanged. Any legacy priority work must be drained by old consumers before upgrading.
- Custom Redis connections must implement
execute(). Redis Cluster namespaces require a shared hash tag; an existing namespace change requires draining or migrating its keys. - Outstanding Redis payloads and ownership persist until completion or atomic recovery. Heartbeat expiry permits recovery but does not itself revoke ownership. Positive
jobTtlapplies to payloads retained after rejection or dead-lettering. - Before rollback, drain outstanding work and recover reservation lists with a queue 5 consumer still available. Older consumers cannot recover those reservations.
- NATS requires
utopia-php/nats ^1.4. Existing third-party single-message renewal remains supported.
See the design and rollout guide for compatibility details.
Changes
- refactor(queue): name synchronous batch publishing publishMany
- test(queue): assert release and prefetch behavior through public APIs
- test(queue): replace Lua emulation with real Redis coverage
- refactor(queue): model prefetch and explicit acknowledgements
- Separate Redis ownership from liveness and retain outstanding payloads
- Remove queue priority and simplify NATS consumption
- Recover queue command connections after failed acknowledgements
- Record released NATS dependency for queue batching
- Delegate selected-message confirmations to JetStream ackBatch
- Adapt acknowledgements to callback-only NATS requests
- Separate queue prefetch from coroutines and batch broker transitions