0.0
No commit activity in last 3 years
No release in over 3 years
Run any method in the background
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

>= 0

Runtime

 Project Readme

BackgroundLite¶ ↑

This gem allows you to execute methods in a background task with a very intuitive and easy syntax. It is as easy as that:

class MyModel
  def complex_operation(argument)
    ...
  end
  background_method :complex_operation
end

Now, whenever MyModel#complex_operation is called, it will be run in the background process.

Refer to the Class#background_method documentation for details.

What this gem is¶ ↑

This gem is an easy-to-use interface for background processing frameworks. Theoretically, you can use it in combination with any of the messaging / background processing frameworks out there, though there are not many handlers implemented yet. However, implementing a handler is very easy.

What this gem is NOT¶ ↑

This gem is NOT a background processing framework. To make it work efficiently, you need an existing framework installed and configured. Right now, support for the ActiveMessaging framework is implemented.

However, there is out-of-the-box support for using script/runner to perform background tasks, as well as forking.

When to use it¶ ↑

  • Your Rails process gets unresponsive due to some time-consuming task.

  • The task does not need to show an immediate effect.

Features¶ ↑

  • Background processing using multiple background processing frameworks.

  • Fallback processing, if your background processing framework isn’t responding correctly.

  • Works out-of-the-box with script/runner and forking and DRb.

  • Fallback handler that streams messages containing background tasks to disk, to later replay jobs that failed because of a temporary error.

  • Error reporting through different channels, depending on the task at hand.

    • Exception notification.

    • Stdout (useful for debugging).

    • Stderr (useful for debugging).

    • Silent, which swallows all exceptions.

  • Supported processing frameworks.

    • ActiveMessaging.

    • Resque

    • script/runner.

    • fork (works only on Unix-like environments).

    • DRb with an example runner executable “background_queue” (not really suitable for production use)

    • others might follow (it’s really easy to write a handler).

  • Easy configuration, depending on the environment, in config/background.yml.

  • Ability to override the configuration per method.

Dependencies¶ ↑

There are no dependencies besides ActiveSupport, which is required by Rails anyways.

Installation¶ ↑

gem install background_lite

or use Bundler

gem "background_lite"

Configuration¶ ↑

Depending on the background processing framework that you are using, you might have to do some configuration. See the documentation of the respective background handler for details.

Copyright © 2008-2013 Thomas Kadauke, released under the MIT license