vedmed
vedmed

Reputation: 355

How is correct to run php consumer-script for rabbitmq?

I need help.

I have a few tasks their need to run after record added to DB. For example: compressing uploaded pictures. For doing it, I using RabbitMQ.

I have separate script, it's fully equal this example, except logic in process_message function: https://github.com/php-amqplib/php-amqplib/blob/master/demo/amqp_consumer_non_blocking.php.

As I understand this long-life running script, I run it in Linux by using command:

nohup php amqp_consumer.php production &

But sometimes this task is crashing. And I can't control it. I need to have methods to restart this task automatically.

Could your please give me advice how you run consumer? How you control it and restart? Thank you.

Upvotes: 1

Views: 899

Answers (1)

vedmed
vedmed

Reputation: 355

Thank all for help! I start using supervisord and using cron to restart task four time in day.

Upvotes: 1

Related Questions