yii2-queue icon indicating copy to clipboard operation
yii2-queue copied to clipboard

MongoDB Driver Support

Open samuelrajan747 opened this issue 10 months ago • 4 comments

The queue extension sounds awesome, but it lacks MongoDB driver support. I believe changes would be needed in the below mentioned lines and around the whole mutex concept.

I would be really happy to see MongoDB driver support in the official Queue extension. Thanks in advance.

https://github.com/yiisoft/yii2-queue/blob/98ea96a4b0c66453cfbe385b91126fc271cef892/src/drivers/db/Queue.php#L32-L43 https://github.com/yiisoft/yii2-queue/blob/98ea96a4b0c66453cfbe385b91126fc271cef892/src/drivers/db/Queue.php#L58-L67 https://github.com/yiisoft/yii2-queue/blob/98ea96a4b0c66453cfbe385b91126fc271cef892/src/drivers/db/Queue.php#L167-L168

samuelrajan747 avatar Jun 25 '25 07:06 samuelrajan747

I think using queues with MongoDB is a strange solution. Why do you want to use MongoDB for queues? Perhaps you should consider using, for example, ZeroMQ if more 'standard' queues don't suit your needs?

s1lver avatar Jun 25 '25 08:06 s1lver

Hi @s1lver, our projects use mongodb as the backing DB. We don't want to add any other dependencies. Also, we don't want to use file driver because we might have multiple instances connecting to the same DB in some HA situations.

samuelrajan747 avatar Jun 25 '25 08:06 samuelrajan747

Asking for the sake of understanding. Why would you say MongoDB is a strange solution and non-standard queue? Based on my research, MongoDB doesn't need an external Mutex.

samuelrajan747 avatar Jun 26 '25 05:06 samuelrajan747

Could you make a PR with your implementation? It would be great if you could branch off from the 3.0 branch, which has minimal PHP 8.1 support.

s1lver avatar Jul 04 '25 09:07 s1lver