Class: Taskinator::Queues::DelayedJobAdapter

Inherits:
Object
  • Object
show all
Defined in:
lib/taskinator/queues/delayed_job.rb

Defined Under Namespace

Classes: CreateProcessWorker, TaskWorker

Instance Method Summary collapse

Constructor Details

#initialize(config = {}) ⇒ DelayedJobAdapter

Returns a new instance of DelayedJobAdapter.



11
12
13
# File 'lib/taskinator/queues/delayed_job.rb', line 11

def initialize(config={})
  @config = Taskinator::Queues::DefaultConfig.merge(config)
end

Instance Method Details

#enqueue_create_process(definition, uuid, args) ⇒ Object



15
16
17
18
# File 'lib/taskinator/queues/delayed_job.rb', line 15

def enqueue_create_process(definition, uuid, args)
  queue = definition.queue || @config[:definition_queue]
  ::Delayed::Job.enqueue CreateProcessWorker.new(definition.name, uuid, Taskinator::Persistence.serialize(args)), :queue => queue
end

#enqueue_task(task) ⇒ Object



20
21
22
23
# File 'lib/taskinator/queues/delayed_job.rb', line 20

def enqueue_task(task)
  queue = task.queue || @config[:task_queue]
  ::Delayed::Job.enqueue TaskWorker.new(task.uuid), :queue => queue
end