Problems related to the persistence of php rabbitmq

Source: Internet
Author: User
Tags rabbitmq
Php uses rabbitmq for persistence. $ ename & nbsp ;=& nbsp; "ename14"; $ qname & nbsp ;=& nbsp; "qname14"; $ con & nbsp; = & nbsp; new & nbsp; AMQPConnection (); $ con-& php unable to persist with rabbitmq
$ 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 );

The red area above. Is declared to be persistent. However, after the server is restarted, the data in the queue disappears. Has anyone ever met?
------ Solution --------------------
$ Ex-> publish allows you to set persistent parameters.
Reference http://haili.me/archives/tag/RabbitMQ%E6%8C%81%E4%B9%85%E5%8C%96

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.