[英]Using Iron.mq push queue with PHP
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. 我正在尝试使用iron.mq推送队列,但是在弄清楚接收到消息后如何正确响应队列时遇到了困难。 I realize that I might also not fully understand how the queue system behaves, but my understanding is that it is something like this:
我意识到我可能还没有完全理解队列系统的行为,但是我的理解是,它是这样的:
For example, my script (using FuelPHP) has something like this: 例如,我的脚本(使用FuelPHP)具有以下内容:
$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: 现在,我已经收到该消息,我想执行以下两项操作之一:
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.
使用PHP SDK的deleteMessage方法会导致异常,因为该消息似乎不再存在。
Version 1. Endpoint responded with status 202. http://dev.iron.io/mq/reference/push_queues/#how_the_endpoint_should_handle_push_messages You should explicitly delete a message after processing via deleteMessagePushStatus()
版本1端点状态202回应http://dev.iron.io/mq/reference/push_queues/#how_the_endpoint_should_handle_push_messages处理后通过你应该明确的删除消息
deleteMessagePushStatus()
Version 2. Endpoint responded with status 200. Message will be deleted automatically, no actions required 版本2。端点状态为200。消息将自动删除,无需执行任何操作
so - two ways: 所以-两种方式:
deleteMessagePushStatus()
deleteMessagePushStatus()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.