Module: Resque

Defined in:
lib/resque_future.rb,
lib/resque/future.rb

Overview

Extend Resque namespace to add enqueue_future method.

Defined Under Namespace

Modules: Future

Instance Method Summary collapse

Instance Method Details

#enqueue_future(klass, *args) ⇒ Object

Same as enqueue excepts it return a FutureJob allowing for later querying the return value of the processed job.



13
14
15
# File 'lib/resque_future.rb', line 13

def enqueue_future(klass, *args)
  enqueue_future_with_uuid(nil, klass, *args)
end

#enqueue_future_with_uuid(uuid, klass, *args) ⇒ Object

Same as enqueue_future excepts it allows manually setting the UUID for the future object.



18
19
20
# File 'lib/resque_future.rb', line 18

def enqueue_future_with_uuid(uuid, klass, *args)
  ResqueFuture::FutureJob.create(queue_from_class(klass), uuid, klass, *args)
end

#get_future_job(uuid, klass) ⇒ Object

Get a future job



23
24
25
# File 'lib/resque_future.rb', line 23

def get_future_job(uuid, klass)
  ResqueFuture::FutureJob.get(queue_from_class(klass), uuid)
end