Module: TorqueBox::Messaging::Backgroundable

Extended by:
BackgroundableClassMethods
Defined in:
lib/torquebox/messaging/backgroundable.rb

Overview

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

Defined Under Namespace

Modules: BackgroundableClassMethods, Util Classes: BackgroundProxy

Constant Summary collapse

MUTEX =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Mutex.new

Class Method Summary collapse

Instance Method Summary collapse

Methods included from BackgroundableClassMethods

__enable_backgroundable_newrelic_tracing, always_background, method_added, singleton_method_added

Class Method Details

.included(base) ⇒ Object



36
37
38
39
40
# File 'lib/torquebox/messaging/backgroundable.rb', line 36

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

.newrelic_available?Boolean

Signals if the newrelic gem is loaded.

Returns:

  • (Boolean)


43
44
45
# File 'lib/torquebox/messaging/backgroundable.rb', line 43

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::BackgroundableClassMethods#always_background.

Parameters:

Returns:



52
53
54
# File 'lib/torquebox/messaging/backgroundable.rb', line 52

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