简体   繁体   English

自动python XMPP服务器和django接口之间的最佳连接方法?

[英]Best method of connection between automated python XMPP server and interface to django?

I have an XMPP server (likely — python, twisted, wokkel), which I prefer not to restart even in the development version, and I have some python module “worker” (which is interface to particular django project), which gets jid and message text and returns some response (text or XML, either way). 我有一个XMPP服务器(可能是python,twisted,wokkel),即使在开发版本中,我也不想重启。我还有一些python模块“ worker”(它是特定django项目的接口),它得到了jid和消息文本并返回一些响应(文本或XML,任一种方式)。

The question is, what would be the best way to connect them, considering that I may prefer to update the module part too often? 问题是,考虑到我可能更喜欢经常更新模块部件,连接它们的最佳方法是什么? Another consideration is that it might be required to run multiple instances of “worker” for it all to be high-load-capable. 另一个考虑因素是,可能需要运行多个“ worker”实例才能使它们全部具有高负载能力。

One possible way I see is implementing a thread in the server which checks if the module was changed and reload()s it if necessary. 我看到的一种可能的方法是在服务器中实现一个线程,该线程检查模块是否已更改,并在必要时对其进行reload()s处理。 The other way would be making something similar to fastcgi through sockets, although not HTTP-based. 另一种方法是通过套接字创建类似于fastcgi的内容,尽管它不是基于HTTP的。

My suggestion is: 我的建议是:

  1. Use RabbitMQ with XMPP adaptor. 将RabbitMQ与XMPP适配器一起使用。
  2. Use Python carrot for AMQP since it can be used directly under Django. 将AMQP使用Python 红萝卜 ,因为它可以直接在Django下使用。

I can't say that I understand all of your question, but the bit where you're asking how to connect django and twisted and multiple workers: I'd suggest using AMPQ. 我不能说我理解您所有的问题,但是您在哪里询问如何连接Django和扭曲工人及多名工人:我建议使用AMPQ。 This gets you reliable message delivery, multiple consumers, persistence. 这样可以为您提供可靠的消息传递,多个使用者和持久性。

There's the txAMQP library for twisted. 有用于扭曲的txAMQP库。
https://launchpad.net/txamqp https://launchpad.net/txamqp

A good primer to AMQP here, it's a good place to start: 这里是AMQP的良好入门,这是一个很好的起点:
http://blogs.digitar.com/jjww/2009/01/rabbits-and-warrens/ http://blogs.digitar.com/jjww/2009/01/rabbits-and-warrens/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM