I would like to start a process in a worker upon a payload I receive through a message queue power by ironMQ. With ironMQ it's possible to create a push queue but that requires an http endpoint.
Is it possible to set up an http endpoint for a heroku worker or will I just have to pull queues from the worker?
There are a few options:
1) If you're using a Heroku worker, you'll have to poll IronMQ for messages. This is really easy, just do it in a loop like this Ruby example:
while true
msg = queue.get
if msg != nil
process_message(msg)
else
sleep 1 # Be sure to sleep so we don't waste API calls and CPU!
end
end
2) Use IronMQ Push Queues to hit an endpoint on your Heroku app, instead of using a Heroku worker and put the process_message
code into that endpoint.
3) Use IronWorker .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.