AMQP与XMPP对接

发布于 2024-11-24 16:57:24 字数 275 浏览 2 评论 0原文

我正在寻找一种编写 XMPP 机器人的方法,该机器人将侦听 RabbitMQ 队列并向 XMPP 通道发送消息,通知用户任何新问题(已经让 Nagios 向 RabbitMQ 发送通知)。

我尝试过使用 xmppy,但它停止工作,我偶然发现了 SleekXMPP,它看起来相当好。

我只是想知道是否定义一个 AMQP 侦听器来自动调用机器人中的 XMPP“发送”方法。因此它将同时监听 AMQP 和 XMPP。

感谢您的帮助!

编辑:BOSH 在这里会是更好的解决方案吗?

I'm looking for a way to write a XMPP bot that would listen to a RabbitMQ queue and send messages to the XMPP channel notifying users of any new issues ( already got Nagios sending notifications to RabbitMQ).

I've tried using xmppy and it stopped working and I stumbled across SleekXMPP which looks fairly better.

I'm just wondering if I define a AMQP listener to automatically call the XMPP "send" method in the bot. So it would be listening both on AMQP and XMPP at the same time.

Thank you for your help!

Edit: Would BOSH be much better solution here ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

时光磨忆 2024-12-01 16:57:24

您的解决方案中最有趣的部分是该领域的许多库都假设它们是唯一的事件循环。您要么需要将每个线程放入自己的线程中(看似更容易,但充满潜在的锁定问题),使用非阻塞 I/O 方法,例如 Twisted(但您需要一个 AMQP ),或提取您正在使用的每个库中的套接字文件描述符,并对它们运行 select() 或 poll() 以告知何时有数据要读取。在这三种方法中,Twisted 方法对我来说似乎是最简单的。

BOSH只会让问题变得更加困难。别走那条路。

The most interesting part of your solution will be that many libraries in this space assume that they are the only event loop. You'll either need to put each in its own thread (seemingly easier, but fraught with lurking locking issues), use a non-blocking I/O approach like Twisted (but you'll need an AMQP library), or extract the socket file descriptors out of each of the libraries you're using and run select() or poll() over them to tell when there is data to read. Of these three, the Twisted approach seems easiest to me.

BOSH will just make the problem more difficult. Don't go that way.

影子的影子 2024-12-01 16:57:24

这确实很简单。我建议您首先编写一个 AMQP 侦听器,仅打印出收到的消息。一旦您开始工作,如何将其集成到 XMPP 机器人中应该是显而易见的。

This is really quite simple. I suggest that you start by writing an AMQP listener that simply prints out received messages. Once you get that working it should be obvious how to integrate that into an XMPP bot.

愿与i 2024-12-01 16:57:24

您可以使用 ejabberd 和 xmpp 插件,如下所示 https://github.com/rabbitmq/rabbitmq-xmpp

You can use ejabberd and a xmpp plugin like this https://github.com/rabbitmq/rabbitmq-xmpp

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文