Sha256: c748b6cd5d228ae8d93d54dfbbad91204f9de0807359eeb7f79982294b85fbdc
Contents?: true
Size: 1.54 KB
Versions: 19
Compression:
Stored size: 1.54 KB
Contents
module Taskinator module Queues # https://github.com/mperham/sidekiq def self.create_sidekiq_adapter(config={}) SidekiqAdapter.new(config) end class SidekiqAdapter def initialize(config={}) @config = Taskinator::Queues::DefaultConfig.merge(config) end 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 def enqueue_process(process) queue = process.queue || @config[:process_queue] TaskWorker.client_push('class' => ProcessWorker, 'args' => [process.uuid], 'queue' => queue) end def enqueue_task(task) queue = task.queue || @config[:task_queue] TaskWorker.client_push('class' => TaskWorker, 'args' => [task.uuid], 'queue' => queue) end class CreateProcessWorker include ::Sidekiq::Worker def perform(definition_name, uuid, args) Taskinator::CreateProcessWorker.new(definition_name, uuid, args).perform end end class ProcessWorker include ::Sidekiq::Worker def perform(process_uuid) Taskinator::ProcessWorker.new(process_uuid).perform end end class TaskWorker include ::Sidekiq::Worker def perform(task_uuid) Taskinator::TaskWorker.new(task_uuid).perform end end end end end
Version data entries
19 entries across 19 versions & 1 rubygems