[rabbitmq-discuss] TTL on Consumers in PHP
Sean Joyce
sean.joyce at patientco.com
Tue Jun 24 21:41:59 BST 2014
I've got a pretty basic consumer running on an exchange that routes various
different messages to client-specific queues. To better manage resources,
I'd like for the consumers to expire after not receiving a message for a
period of time (low-usage clients).
I've been trying to figure out where to call basic_cancel in this code, but
not finding the right solution. Any tips on how to refactor and get what I
want?
public function consume() {
$callback = function($msg) {
$pMsg = new ProcessorMessage();
$pMsg->onMessage($msg->body);
$msg->delivery_info['channel']->basic_ack($msg->delivery_info['delivery_tag']);
};
$this->channel->basic_qos(null, 1, null);
$this->channel->basic_consume($queue_name, '', false, false, false,
false, $callback);
while(count($this->channel->callbacks)) {
$this->channel->wait();
}
}
--
*Sean M. Joyce*
Director of Product Engineering | Patientco
sean.joyce at patientco.com
888.747.2455 x412
<http://info.patientco.com/himss>
<http://info.patientco.com/happy-providers>
--
As a friendly reminder, never send Protected Health Information (PHI) via
email.
CONFIDENTIALITY NOTICE: The information contained in this email message
may be privileged, confidential, and protected from disclosure.
Any unauthorized use, printing, copying, disclosure, dissemination of or
reliance upon this communication by persons other than the intended
recipient may be subject to legal restriction or sanction. If you are not
the intended recipient, you are hereby notified that you are not authorized
to read, print, retain, copy, or disseminate this message, any part of it,
or any attachments. If you think that you have received this email
message in error, please reply to the sender and delete this email and any
attachments and all copies thereof from your system without reading the
content and destroy any printouts of the e-mail or attachments promptly.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20140624/b51f22ed/attachment.html>
More information about the rabbitmq-discuss
mailing list