php使用rabbitmq无法持久化问题

WBOY
Release: 2016-06-23 14:01:01
Original
1080 people have browsed it

$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

source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template