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:
- Message sent to queue
- Message pushed from queue to my endpoint
- Message is 'reserved' until my endpoint responds or times out
- 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:
- Process message and return response to ironmq servers that it was successful
- 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.