Class: Taskinator::Queues::ActiveJobAdapter

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

Defined Under Namespace

Classes: CreateProcessWorker, TaskWorker

Instance Method Summary collapse

Constructor Details

#initialize(config = {}) ⇒ ActiveJobAdapter

Returns a new instance of ActiveJobAdapter.



11
12
13
# File 'lib/taskinator/queues/active_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
19
# File 'lib/taskinator/queues/active_job.rb', line 15

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

#enqueue_task(task) ⇒ Object



21
22
23
24
25
# File 'lib/taskinator/queues/active_job.rb', line 21

def enqueue_task(task)
  queue = task.queue || @config[:task_queue]
  TaskWorker.set(:queue => queue)
    .perform_later(task.uuid)
end