PHP进程间通信以监视消息队列 [英] PHP Inter-process communication to monitor message queue

查看:90
本文介绍了PHP进程间通信以监视消息队列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在从事一个项目,在该项目中我可以为排行榜和其他几个位置生成统计数据.我的目标是使它尽可能实时,因此,我为此实现了RabbitMQ服务器来进行消息排队.

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.

在前端,我有一个nodejs设置,用于将信息提供给正在观看信息的客户端.在同一台服务器上,我有一个PHP进程来侦听队列并将消息记录到数据库中以获取历史记录.我现在要解决的问题是如何在nodejs系统和该PHP进程之间进行通信而又不影响数据库.

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.

推荐答案

RabbitMQ消息队列已经是一种很好的通信方式.只需使用它,并让PHP进程和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包含PHP的教程,库和文档的列表. Rabbit.js似乎是Node的不错选择. js .

这篇关于PHP进程间通信以监视消息队列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆