Rails 中的异步 Actionmailer [英] Asynchronous Actionmailer in Rails

查看:46
本文介绍了Rails 中的异步 Actionmailer的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到我的一些操作(在开发环境中)需要一段时间才能加载为电子邮件,它们需要电子邮件通知(通过 Google 的服务器).我是否需要实现电子邮件的异步处理,例如 - http://upstream-berlin.com/2008/05/19/new-rails-plugin-for-making-actionmailer-asynchronous/

I've noticed some of my actions (on a development environment) take a little while to load up as an email they require an email notification (through Google's servers). Do I need to implement asynchronous handling of emails like - http://upstream-berlin.com/2008/05/19/new-rails-plugin-for-making-actionmailer-asynchronous/

推荐答案

卸载可能需要长时间运行的任务(例如将电子邮件发送到后台)是提高应用程序响应能力的好主意,尽管这样做会牺牲应用程序的简单性应用一点.

Offloading potentially long-running tasks such as sending emails in to the background is a good idea to improve the responsiveness of your application, albeit by sacrificing the simplicity of your application a little.

执行此操作的一种流行方法(我已成功使用)是使用 Delayed Job.README 文件包含在后台发送电子邮件是多么简单的示例 - 基本上您只需使用 send_later 方法.

One popular way to do this (which I have used with great success) is using Delayed Job. The README file contains examples of how simple it is to send email in the background -- basically you just use the send_later method.

这是另一个很好的教程的链接:

Here's a link to another good tutorial:

http://railstips.org/2008/11/19/延迟满足铁路

这篇关于Rails 中的异步 Actionmailer的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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