Sha256: 4ae844417caed88fb4b52aac378fd4d3f984317187c7622432f503d5086fbee5

Contents?: true

Size: 659 Bytes

Versions: 2

Compression:

Stored size: 659 Bytes

Contents

module MultiWorker
  module Adapters
    class QueueClassic
      def self.configure(base, opts={})
        base.class_eval do
          @queue = ::QC::Queue.new(opts[:queue])

          def self.perform(*args)
            self.new.perform(*args)
          end

          def self.perform_async(*args)
            @queue.enqueue("#{self}.perform", *args)
          end

          def perform_async(*args)
            self.class.perform_async(*args)
          end
        end
      end

      def self.rake_task
        require 'rake'
        require 'queue_classic/tasks'
        ::Rake::Task["qc:work"]
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
multi_worker-0.2.0 lib/multi_worker/adapters/queue_classic.rb
multi_worker-0.1.0 lib/multi_worker/adapters/queue_classic.rb