iron_mq_php icon indicating copy to clipboard operation
iron_mq_php copied to clipboard

Calling deleteMessagePushStatus() getting 404

Open nodesocket opened this issue 9 years ago • 3 comments

Recently we've been seeing an error when deleting/acknowledging an IronMQ message.

// The call looks like
$ironmq->deleteMessagePushStatus(..., ..., ...);

Response is a 404 with:

 Message not found.

Initially we thought we must be calling deleteMessagePushStatus() multiple times, but after checking our code, there is only a single call.

What is happening?

nodesocket avatar May 21 '15 07:05 nodesocket

Anybody?

nodesocket avatar May 26 '15 20:05 nodesocket

are you setting a timeout on your message that you place on the queue? (if not the default is still 60 seconds) how long does the GET, processing, and then send a DELETE?

if could be possible after the first consumer does a GET if 60 seconds(timeout) passes the message ends up back on the queue and is processed by a 2nd consumer. the first consumer sends the delete request which gets received successfully and the second consumer gets a 404 when it attempts a delete.

Stephenitis avatar May 28 '15 00:05 Stephenitis

So, we create a queue for each message (push) and then queue a message. The exact code is like:

////
// Create the IronMQ queue
//
//  Unicast queue
//      80 retries every 15 seconds, total retry time of 20 minutes.
////
$ironmq_options = array(
    "push_type" => "unicast",
    "retries" => 80,
    "retries_delay" => 15,
    "subscribers" => array(
        array(
            "url" => $subscriber_url,
            "headers" => $ironmq_http_headers
        )
     ),
    "error_queue" => "error-api-executions"
);

$ironmq_queue = $ironmq->updateQueue($ironmq_queue_name, $ironmq_options);

////
// Send the message to the newly created IronMQ queue
//
// Timeout after 20 minutes.
////
$ironmq_response = $ironmq->postMessage($ironmq_queue_name, $json_payload, array(
    "timeout" => 60*20
));

Total time from creating the queue and adding the message to trying to delete it is fast. Basically, as long as it takes Iron.io to send the message to the push endpoint. One of the first things the push endpoint does, is delete the message and queue. So let's call it less than 250ms once Iron.io sends the message to the push endpoint.

nodesocket avatar May 28 '15 01:05 nodesocket