Home  >  Article  >  Backend Development  >  php使用rabbitmq无法持久化问题

php使用rabbitmq无法持久化问题

WBOY
WBOYOriginal
2016-06-23 14:01:011081browse

$ename = "ename14";
$qname = "qname14";
$con = new AMQPConnection();
$con->connect();
$ch  = new AMQPChannel($con);


$ex    = new AMQPExchange($ch);
$ex->setName($ename);
$ex->setType(AMQP_EX_TYPE_DIRECT);
$ex->setFlags(2);
$ex->declare();

$q   = new AMQPQueue($ch);
$q->setName($qname);
$q->setFlags(2);
$q->declare();
$q->bind($ex->getName(),$qname);
$ex->publish(time(),$qname);

上面标红的地方。是声明需要持久化。但是重起服务器之后,队列里面的数据就不见了。有谁遇到过吗


回复讨论(解决方案)

$ex->publish 可以设置持久化的参数
参考 http://haili.me/archives/tag/RabbitMQ%E6%8C%81%E4%B9%85%E5%8C%96

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn