RabbitMQ + PHP Deployment Strategy

I have a PHP project (Symfony2) that uses RabbitMQ. I use it as a simple message queue to delay some tasks (sending letters, important data from the API). Consumers run on a web server, and their code is part of the webserver repo - they are deployed along with the network.

Questions: How do I start consumers as demons and make sure they always work? When you deploy an application, how do you turn off consumers โ€œgracefullyโ€ so that they stop consuming but finish processing the message that they started?

If this is important, I use Capifony for deployment.

Thanks!

+4
source share
1 answer

It might be worth a look at something supervisord that is written in python. I used it before to run workers for Gearmand, which is a job queue that fully fulfills the same role as you use RabbitMQ.

+2
source

Source: https://habr.com/ru/post/1387203/


All Articles