_connect = self::connect(); $this->_channel = $this->_connect->channel(); } /** * [创建队列] * @author: libingke * @param string $queueName * @return array */ public function create($queueName) { try { list($callback_queue, ,) = $this->_channel->queue_declare( (string) $queueName, false, 0,//持久化 false, false ); return ['status' => 1, 'result' => $callback_queue]; } catch (AMQPProtocolChannelException $e) { return ['status' => 0, 'result' => $e->getMessage()]; } } /** * [删除队列] * @author: libingke * @param string $queueName * @return array */ public function delete($queueName) { try { $this->_channel->queue_delete((string) $queueName); return ['status' => 1, 'result' => 'OK']; } catch (AMQPProtocolChannelException $e) { return ['status' => 0, 'result' => $e->getMessage()]; } } }