1

I'm attempting to use the iron.mq push queue, but am having difficulty figuring out how to properly respond to the queue after receiving a message. I realize that I might also not fully understand how the queue system behaves, but my understanding is that it is something like this:

  1. Message sent to queue
  2. Message pushed from queue to my endpoint
  3. Message is 'reserved' until my endpoint responds or times out
  4. Endpoint responds with either a 2xx (success) and it is deleted or 4xx/5xx failure, in which case the queue will attempt to resend the message to the endpoint.

For example, my script (using FuelPHP) has something like this:

    $headers = Input::headers(); //gets array of headers sent from ironmq
    $data = @file_get_contents('php://input'); //get the body

Now that I have received the message, I want to do one of two things:

  1. Process message and return response to ironmq servers that it was successful
  2. Delay the process (by sending a 4xx/5xx?) and have it be resent after a defined period of time.

But... how do you respond to a push message? Using the PHP SDK's deleteMessage method causes an exception as the message appears to no longer exist.

Anti-Dentite
  • 551
  • 1
  • 6
  • 11

1 Answers1

1

so - two ways:

  1. 202 -> do long work -> deleteMessagePushStatus()
  2. 4xx or 5xx -> 4xx or 5xx (many times) -> 200
thousandsofthem
  • 1,355
  • 10
  • 9
  • Thanks. deleteMessagePushStatus() works to delete a message. I don't see a method in the SDK that sends a 4xx or 5xx though. Is there one? – Anti-Dentite Jun 27 '13 at 22:21
  • @Anti-Dentite your endpoint is the one that would return 4xx or 5xx if it was having issues. IronMQ will retry up to the number of retries you have set on the push queue. If your endpoint returns a 200, it's all good, message is deleted automatically like thousandsofthem said. Or you can return 202 if you need a lot of time to process the message. – Travis Reeder Jun 29 '13 at 20:19