Expand description
Queue workers that share their queues with utopia-php/queue.
Worker consumes a queue on NATS JetStream the way Utopia\Queue\Broker\Nats does, so a
Rust worker and PHP workers can take messages from the same queue at the same time:
- It joins the
workerdurable consumer on theQ_<NAME>stream thatBroker\Natsprovisions. It provisions nothing itself: publishers create the stream on their first publish, and a worker started before that waits for it. - Messages are the JSON envelope
Broker\Natswrites:pid,queue,timestampandpayload. - The redelivery budget and the backoff are read from the consumer, which carries the values the queue’s DSN gave it, so this worker retries exactly as the PHP ones do.
- What
Broker\Natsdead-letters, this dead-letters to the same subjects with the same headers, soretry()in PHP requeues it.
What stays with the PHP workers sharing the queue: provisioning, the max-deliveries advisory
and reap(). Both of the last two only matter for a message whose every delivery died
unacknowledged, which Worker::receive dead-letters itself on its spare delivery.
Structs§
- Delivery
- A message taken from the queue, held until it is committed or rejected.
- Envelope
- A message as
Broker\Natsenqueues it. - Worker