http endpoint for a heroku worker

120 views Asked by At

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?

1

There are 1 answers

0
Travis Reeder On

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.