Class: Taskinator::Queues::SidekiqAdapter

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

Defined Under Namespace

Classes: CreateProcessWorker, TaskWorker

Instance Method Summary collapse

Constructor Details

#initialize(config = {}) ⇒ SidekiqAdapter

Returns a new instance of SidekiqAdapter.



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

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

#enqueue_task(task) ⇒ Object



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

def enqueue_task(task)
  queue = task.queue || @config[:task_queue]
  TaskWorker.client_push('class' => TaskWorker, 'args' => [task.uuid], 'queue' => queue)
end