Message queues
If you use cron jobs—or some other external process manager—to manage message queues instead of RabbitMQ, you may need to use an environment variable to restart message queue consumers after every deployment.
Symptom
Message queue consumers fail to restart after you deploy code to an environment.
Solution
Use the CRON_CONSUMERS_RUNNER
environment variable to ensure that consumers are retrieving messages from the message queue.
You must set the variable value using JSON. For example:
{
"cron_run":"true",
"max_messages":1000,
"consumers":[
"consumer1",
"consumer2"
]
}
cron_run
—A boolean value that enables or disables theconsumers_runner
cron job (default =false
).max_messages
—A number specifying the maximum number of messages each consumer must process before terminating (default =1000
). Although we do not recommend it, you can use0
to prevent the consumer from terminating.consumers
—An array of strings specifying which consumer(s) to run. An empty array runs all consumers. Refer to List consumers for more information.