PHP进程间通信监控消息队列
我正在开发一个项目,为排行榜和其他几个位置生成统计数据。我的目标是尽可能实时,因此为此我实现了一个用于消息队列的 RabbitMQ 服务器。
在前端,我有一个 Nodejs 设置,用于将信息提供给正在观看它的客户。在同一台服务器上,我有一个 PHP 进程来监听队列并将消息记录到数据库中以获取历史记录。我现在正在尝试解决的是如何在不访问数据库的情况下在nodejs系统和PHP进程之间进行通信。
I'm working on a project where I'm generating stats for a leaderboard and several other locations. My goal with this is to have it as real-time as possible, so to that end I have implemented a RabbitMQ server for message queueing.
On the frontend, I have a nodejs setup, to feed the information out to the clients who are watching it. On that same server, I have a PHP process to listen to the queue and log the messages to a database for history. What I'm trying to work out now is how to communicate between the nodejs system and that PHP process without hitting the database.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
RabbitMQ 消息队列已经是一种极好的通信方式。只需使用它并让 PHP 进程和 Node.js 订阅它和/或根据需要通过它进行通信。
RabbitMQ.com 有 PHP 教程、库和文档列表。 < a href="http://www.rabbitmq.com/blog/2010/11/12/rabbitmq-nodejs-rabbitjs/" rel="nofollow">Rabbit.js 似乎是 Node.js 的一个不错的选择。
Your RabbitMQ message queue already is an excellent means of communication. Just use that and make both the PHP process and Node.js subscribe to it and/or communicate through it as necessary.
RabbitMQ.com has a list of tutorials, libraries, and docs for PHP. Rabbit.js seems to be a good bet for Node.js.