Rails简单通讯/邮件列表,通过电子邮件通知新的搜索结果 [英] Rails simple Newsletter / Mailing List with notification of new search results via email

查看:345
本文介绍了Rails简单通讯/邮件列表,通过电子邮件通知新的搜索结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的用户可以保存他们的首选搜索。现在我需要给他们订阅它们的可能性,以便在有新的搜索结果时收到电子邮件通知(例如Yahoo答案)。

My users can save their preferred searches. Now I need to give them the possibility to subscribe to them in order to receive an email notification whenever new search results are available (like on Yahoo answers).

我已经设置

现在,我需要做的就是在手动 计划作业调用邮件程序,但...我真的不是那个领域的专家。因此,在每当时, Delayed_job Sidekiq Resque Scheduler & co。我应该去哪一个(或多个组合的)这种任务(长时间运行的过程与几个邮件)?

Now all I need to do is to call the mailer from a scheduled job but... I really ain't an expert on that field. So, among Whenever, Delayed_job, Sidekiq, Resque Scheduler & co. with which one (or combination of ones) should I go for this kind of task (long-running process with several mailing)?

EDIT

我开发了 >,可在Github上找到: NotiSearch

如果你想开发类似的东西,我肯定会推荐你检查一下。

It's pretty well documented so, if you are trying to develop something like it, I'd definitely recommend you to check it out.

PS:我选择依靠每次 delayed_job ,因为它们没有外部依赖关系,如果需要,应该足够容易转换到更具可扩展性的解决方案。

PS: I chose to rely on whenever and delayed_job since they don't have external dependencies, if needed it should be easy enough to transition to a more scalable solution.

推荐答案

我亲自与Resque和Sidekiq合作。这两者之间的主要区别是Sidekiq为每个作业产生了新的线程。

I've personally worked with Resque and Sidekiq. The main difference between these two is that Sidekiq spawns new threads for each job.

Resque每个作业有一个进程。这基本上意味着Resque假设失败,并且其他作业不会失败,如果一个进程失败。 Sidekiq,因为它与线程,如果其中一个线程锁定了无论什么原因,整个过程将被锁定。

Resque has a process per job. This just basically mean that Resque assumes failure and other jobs won't fail if one process fails. Sidekiq, since it works with threads, if one of those threads locks up for whatever reason the entire process will be locked up.

根据其他质量检查的答案 Resque vs Sidekiq?

From an answer in another QA Resque vs Sidekiq?

返回:

优点:

不需要线程安全(几乎任何宝石都有);
没有解释器偏好(你可以使用任何ruby);
加载插件。
缺省

does not require thread safety (works with pretty much any gem out there); has no interpreter preference (you can use any ruby); loads of plugins. Cons

每个工人运行一个进程(使用更多的内存);
不会重试作业(开箱即用)。
Sidekiq:

runs a process per worker (uses more memory); does not retry jobs (out of the box, anyway). Sidekiq:

优点

每个工人运行线程(使用更少的内存)
少分叉(工作速度更快);
开箱即用的更多选项。
缺点

runs thread per worker (uses much less memory); less forking (works faster); more options out of the box. Cons

[huge]需要线程安全的代码和所有依赖。如果你用线程运行线程不安全的代码,你要求麻烦;
少得多的插件(目前只有2个);
在一些红宝石上的工作比其他人更好(建议使用jruby和rubinius,由于GVL(全局VM锁定),MRI的效率会降低。)

[huge] requires thread-safety of your code and all dependencies. If you run thread-unsafe code with threads, you're asking for trouble; much less plugins (at the moment there are only 2); works on some rubies better than others (jruby and rubinius are recommended, efficiency on MRI is decreased due to GVL (global VM lock)).

EDIT

无论如何回答您的问题。在所有使用邮件的项目中,我们使用Resque。

Anyway to answer your question. In all the projects we've used mailers we use Resque.

这篇关于Rails简单通讯/邮件列表,通过电子邮件通知新的搜索结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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