function recv($msg) { /* 切换logid. */ cy_log_id_renew(); if (call_user_func($this->callback, $msg->body)) { $msg->delivery_info['channel']->basic_ack($msg->delivery_info['delivery_tag']); } /* 统计本次请求的时间 */ cy_stat_flush(); gc_collect_cycles(); }
/** * 返回统一的logid * * * @return int logid */ function cy_log_id() { if (isset($_ENV['logid'])) { return $_ENV['logid']; } return cy_log_id_renew(); }
function recv($envelope) { /* 切换logid. */ cy_log_id_renew(); if (call_user_func($this->callback, $envelope->getBody())) { $this->queue->ack($envelope->getDeliveryTag()); } else { $this->queue->nack($envelope->getDeliveryTag(), AMQP_REQUEUE); } /* 统计本次请求的时间 */ cy_stat_flush(); gc_collect_cycles(); }