Module: TorqueBox::Messaging::Backgroundable

Defined in:
lib/torquebox/messaging/backgroundable.rb

Overview

Backgroundable provides mechanism for executing an object’s methods asynchronously.

Defined Under Namespace

Modules: ClassMethods, Util Classes: BackgroundProxy

Constant Summary collapse

MUTEX =
Mutex.new

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



33
34
35
36
# File 'lib/torquebox/messaging/backgroundable.rb', line 33

def self.included(base)
  base.extend(ClassMethods)
  base.send(:include, FutureStatus)
end

.newrelic_available?Boolean

Signals if the newrelic gem is loaded.

Returns:

  • (Boolean)


39
40
41
# File 'lib/torquebox/messaging/backgroundable.rb', line 39

def self.newrelic_available?
  defined?(NewRelic::Agent)
end

Instance Method Details

#background(options = { }) ⇒ Future

Allows you to background any method that has not been marked as a backgrounded method via TorqueBox::Messaging::Backgroundable::ClassMethods#always_background.

Parameters:

Returns:



48
49
50
# File 'lib/torquebox/messaging/backgroundable.rb', line 48

def background(options = { })
  BackgroundProxy.new(self, options)
end