Module: TorqueBox::Messaging::Backgroundable::Util Private

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

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

Class Method Summary collapse

Class Method Details

.instance_methods_include?(klass, method) ⇒ Boolean

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

Returns:

  • (Boolean)


227
228
229
230
# File 'lib/torquebox/messaging/backgroundable.rb', line 227

def instance_methods_include?(klass, method)
  methods_include?(klass.instance_methods, method) ||
    private_instance_methods_include?(klass, method)
end

.methods_include?(methods, method) ⇒ Boolean

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

Returns:

  • (Boolean)


240
241
242
243
# File 'lib/torquebox/messaging/backgroundable.rb', line 240

def methods_include?(methods, method)
  method = (RUBY_VERSION =~ /^1\.8\./ ? method.to_s : method.to_sym)
  methods.include?(method)
end

.private_instance_methods_include?(klass, method) ⇒ Boolean

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

Returns:

  • (Boolean)


232
233
234
# File 'lib/torquebox/messaging/backgroundable.rb', line 232

def private_instance_methods_include?(klass, method)
  methods_include?(klass.private_instance_methods, method)
end

.private_singleton_methods_include?(klass, method) ⇒ Boolean

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

Returns:

  • (Boolean)


219
220
221
# File 'lib/torquebox/messaging/backgroundable.rb', line 219

def private_singleton_methods_include?(klass, method)
  methods_include?(klass.private_methods, method)
end

.protected_instance_methods_include?(klass, method) ⇒ Boolean

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

Returns:

  • (Boolean)


236
237
238
# File 'lib/torquebox/messaging/backgroundable.rb', line 236

def protected_instance_methods_include?(klass, method)
  methods_include?(klass.protected_instance_methods, method)
end

.protected_singleton_methods_include?(klass, method) ⇒ Boolean

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

Returns:

  • (Boolean)


223
224
225
# File 'lib/torquebox/messaging/backgroundable.rb', line 223

def protected_singleton_methods_include?(klass, method)
  methods_include?(klass.protected_methods, method)
end

.publish_message(receiver, method, args, options = { }) ⇒ Object

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



197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
# File 'lib/torquebox/messaging/backgroundable.rb', line 197

def publish_message(receiver, method, args, options = { })
  queue_name = Task.queue_name( "torquebox_backgroundable" )
  queue = Queue.new( queue_name )
  future = Future.new( queue )
  options[:encoding] = :marshal
  queue.publish( {:receiver => receiver,
                   :future_id => future.correlation_id,
                   :future_queue => queue_name,
                   :future_ttl => options[:future_ttl],
                   :method => method,
                   :args => args}, options )

  future
rescue javax.jms.InvalidDestinationException => ex
  raise RuntimeError.new("The Backgroundable queue is not available. Did you disable it by setting its concurrency to 0?")
end

.singleton_methods_include?(klass, method) ⇒ Boolean

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

Returns:

  • (Boolean)


214
215
216
217
# File 'lib/torquebox/messaging/backgroundable.rb', line 214

def singleton_methods_include?(klass, method)
  methods_include?(klass.singleton_methods, method) ||
    private_singleton_methods_include?(klass, method)
end