/** * Process message publishing * @param string $message */ public function processPublish($message = '', $isDeclared = true) { $connetion = $this->amqpService->amqpConnect(); $channel = $this->amqpService->getAmqpChannel($connetion); $exchange = $this->amqpService->getAmqpExchange($channel, $isDeclared); $queue = $this->amqpService->getAmqpQue($channel, $isDeclared); $res = $this->amqpService->amqpSend($exchange, $message); $this->amqpService->amqpDisconnect($connetion); }
/** * Consume the first limit number of messages in the queue. * @param int $limit * @return boolean */ public function consumeWithLimit($limit = 1000, $isDeclared = true) { $connection = $this->amqpService->amqpConnect(); $channel = $this->amqpService->getAmqpChannel($connection); $exchange = $this->amqpService->getAmqpExchange($channel, $isDeclared); $queue = $this->amqpService->getAmqpQue($channel, $isDeclared); $result = $this->amqpService->amqpReceive($queue, $limit); $this->amqpService->amqpDisconnect($connection); return $result; }