<div dir="ltr"><div>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). </div>
<div><br></div><div>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?</div><div><br></div><div>  public function consume() {</div>
<div>    $callback = function($msg) {      </div><div>      $pMsg = new ProcessorMessage();</div><div>      $pMsg->onMessage($msg->body);</div><div>      $msg->delivery_info['channel']->basic_ack($msg->delivery_info['delivery_tag']);</div>
<div>    };</div><div><br></div><div>    $this->channel->basic_qos(null, 1, null);</div><div>    $this->channel->basic_consume($queue_name, '', false, false, false, false, $callback);</div><div><br></div>
<div>    while(count($this->channel->callbacks)) {</div><div>        $this->channel->wait();</div><div>    }</div><div><br></div><div>  }</div><div><br></div>-- <br><div dir="ltr"><div style="text-align:-webkit-auto;font-size:14px;font-family:Helvetica">
<b style="color:rgb(111,116,122);text-align:-webkit-auto">Sean M. Joyce</b><br></div><div style="text-align:-webkit-auto;font-size:14px;font-family:Helvetica"><font color="#6f747a">Director of Product Engineering | Patientco</font></div>
<div style="text-align:-webkit-auto;font-size:14px;font-family:Helvetica"><font color="#128b48"><a href="mailto:sean.joyce@patientco.com" target="_blank">sean.joyce<font color="#1155cc">@patientco.com</font></a></font></div>
888.747.2455 x412<div style="text-align:-webkit-auto;font-size:14px;font-family:Helvetica"><br></div><a href="http://info.patientco.com/himss" style="color:rgb(17,85,204);font-family:Helvetica;font-size:14px" target="_blank"><br>
</a><a href="http://info.patientco.com/happy-providers" style="color:rgb(17,85,204);font-family:Helvetica;font-size:medium" target="_blank"><img src="http://info.patientco.com/l/25272/2014-01-17/44swk/25272/23818/happyprovider_email_banner.jpg"></a><br>
</div>
</div>

<br>
<div><p style="margin:0in 0in 0.0001pt"><font size="2">As a friendly reminder, never send Protected Health Information (PHI) via email. </font></p><p style="margin:0in 0in 0.0001pt"><font size="1"> </font></p></div><div><p style="margin:0in 0in 0.0001pt"><font size="1"><span style="background-image:initial;background-repeat:initial">CONFIDENTIALITY NOTICE:</span>  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. <span style="background-image:initial;background-repeat:initial">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.</span>  If you think that you have received this email message in error, please reply to the sender and delete this email <span style="background-image:initial;background-repeat:initial">and any attachments and all copies thereof from your system without reading the content and destroy any printouts of the e-mail or attachments </span><span style="background-image:initial;background-repeat:initial">promptly.</span> </font></p></div>