Reputation: 127
I am using eFax to send faxes from my Rails 3.1 app and am wondering what the best way to monitor the status of each fax is. EFax allows you to post a request with an id to find its status and I would like to do this every minute until the fax status is either successful or failed. I am considering creating cron jobs for each fax and then canceling the cron job after success or failure. Or a better solution may be some sort of periodic job server? Does anyone have any experience with something like this or have any suggestions?
Upvotes: 0
Views: 642
Reputation: 12749
Use Delayed Job. http://railscasts.com/episodes/171-delayed-job It will retry N times for you on errors, you can schedule priority or future times to run. You could do a rake task in a crontab as well but it could possibly take a long time to startup every minute, consuming resources.
If you really need it to run on the minute exactly, consider cron with the whenever gem, http://railscasts.com/episodes/164-cron-in-ruby
Upvotes: 1
Reputation: 4004
The easy solution is to create a rake task in your application that finds the fax tasks you need to check and then updates them. Stick it in a cron job and your good to do. Check out whenever for configuring the cron jobs for you.
I would like to suggest a nice job scheduling system but I have been looking for on to use in Rails for several years.
Upvotes: 1