Is it possible to call a Daemon method from a controller
I was wondering whether there is a possibility to call a method which is defined in daemons from a controller.
The reason behind this question is开发者_StackOverflow社区, I need to contact third party server which allows only one connection at a time. To make make a connection independent of passenger instance and to avoid multiple connection open and close I thought of using Deamon gem.
Is it there some other way to over come this problem?
Thanks for your help in advance.
You could use something like resque:
Resque (pronounced like "rescue") is a Redis-backed library for creating background jobs, placing those jobs on multiple queues, and processing them later.
Background jobs can be any Ruby class or module that responds to perform. Your existing classes can easily be converted to background jobs or you can create new classes specifically to do work. Or, you can do both.
精彩评论