如何实现邮件系统与Rails在后台发送电子邮件 [英] How to implement a mailing system with Rails that sends emails in the background

查看:96
本文介绍了如何实现邮件系统与Rails在后台发送电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用Ruby on Rails实现可靠的邮件系统,在后台发送电子邮件,因为发送电子邮件有时需要10秒或更长时间,因此我不希望用户等待。我想到的一些想法:


  1. 写在数据库中的一个表中有一个
    后台进程,
    发送电子邮件(关注:潜在的许多
    读/写DB减慢我的
    应用程序)


  2. 消息队列
    后台进程/耙任务
    (担心:如果服务器崩溃排队
    邮件将丢失也可能会吃掉
    a许多电子邮件的内存)


我想知道您是否知道一个良好的解决方案,可以提供可靠性和性能之间的平衡。

解决方案

我认为Starling and Workling将能够帮助你=)看这个轨道: http://railscasts.com/episodes/128-starling-and-workling


I want to implement a reliable mailing system with Ruby on Rails that sends emails in the background as sending email sometimes takes like 10 seconds or more so I don't want the user to wait. Some ideas I thought of:

  1. Write to a table in DB a have a background process that go over and send email (concern: potential many reads/writes to DB slows down my application)

  2. Messaging Queue background process / Rake task (concern: if server crashes queued mails will be lost also might eat up a lot of memory if many emails)

I was wondering if you a know of a good solution that provides a balance between reliability and performance.

解决方案

I think Starling and Workling will be able to assist you =) Watch this railscast: http://railscasts.com/episodes/128-starling-and-workling

这篇关于如何实现邮件系统与Rails在后台发送电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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