龙卷风无阻塞SMTP客户端 [英] Tornado non-blocking SMTP client

查看:248
本文介绍了龙卷风无阻塞SMTP客户端的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找python异步SMTP客户端连接它与Torando IoLoop。我发现只是简单的含义( http://tornadogists.org/907491/ ),但它是一个阻止解决方案,所以它可能会带来性能问题。



有没有人遇到过Tornado的非阻塞SMTP客户端?一些代码片段也是非常有用的。

解决方案

我根据线程和队列编写了解决方案。每龙卷风过程一线。这个线程是一个工作者,从队列获取电子邮件,然后通过SMTP发送。通过将龙卷风应用程序添加到队列中来发送电子邮件。简单易用。



以下是GitHub上的示例代码:链接


I'am looking for python async SMTP client to connect it with Torando IoLoop. I found only simple implmementation (http://tornadogists.org/907491/) but it's a blocking solution so it might bring performance issues.

Does anyone encountered non blocking SMTP client for Tornado? Some code snippet would be also very useful.

解决方案

I wrote solution based on threads and queue. One thread per tornado process. This thread is a worker, gets email from queue and then send it via SMTP. You send emails from tornado application by adding it to queue. Simple and easy.

Here is sample code on GitHub: link

这篇关于龙卷风无阻塞SMTP客户端的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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