php-enqueue / enqueue-dev

Message Queue, Job Queue, Broadcasting, WebSockets packages for PHP, Symfony, Laravel, Magento. DEVELOPMENT REPOSITORY - provided by Forma-Pro
https://enqueue.forma-pro.com/
MIT License
2.17k stars 430 forks source link

Setting a message priority doesn't seam to work #1269

Open NeilWhitworth opened 2 years ago

NeilWhitworth commented 2 years ago

I have a process which is generating lots (measured in the 1000s) of events to be sent via enque. This obviusly causes a delay for any other events sent afterwards by default.

I have tried to set the priority of the bulk events to _MessagePriority::VERYLOW, but it has no effect - even when other events are excplicity set to a higher priority.

Digging through the enqueue code, I can see that all events are first sent to the router, via GenericDriver::sendToRouter(). This clones the event (via createTransportMessage()) but does not set the priority.

Once the router handes any events, they are pushed via GenericDriver::GenericDriver(). This also clones the event (via the same createTransportMessage()), but also includes a block of code to set the priority - aswell as delay and expiry.

Since eveything must go to the router first, and no prority is set in GenericDriver::sendToRouter(), my bulk events are always blocking any handling of higher priority events sent afterwards.

I am currently using the DBAL driver.