Search code examples
pythonxmppamqp

Interconnecting AMQP and XMPP


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 ?


Solution

  • 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.