RabbitMQ 和不稳定的连接
我将 RabbitMQ 与 PHP 结合使用(通过 php-amqplib)。但是我的消费者运行的服务器的连接确实不稳定。因此,每 15-30 分钟消费者就会失去与远程rabbitmq服务器的连接,但 php 守护进程仍在运行。在这种情况下有什么解决方案可以处理有损连接吗?
I'm using RabbitMQ with PHP (via php-amqplib). But server, where my consumer is running, has really unstable connection. So, each 15-30 minutes consumer losts connection to the remote rabbitmq server, but php daemon still running. Is there any solution to handle lossy connections in this case?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该使用心跳进行连接,但如果此后问题仍然存在,您最好记录连接错误,以便验证连接的情况。
You should use heartbeats for the connection but if the problem continues after that you'd better log the connection errors in order to verify what's going on with the connectivity.