Sha256: 71c6354e90b6c57adff37bb715a35c746d610f43303fe1e16fcf6520a2845301

Contents?: true

Size: 799 Bytes

Versions: 6

Compression:

Stored size: 799 Bytes

Contents

module QueueBus
  module Adapters
    class Sidekiq < QueueBus::Adapters::Base
      def enabled!
        # know we are using it
        require 'sidekiq'
        ::QueueBus::Worker.include ::Sidekiq::Worker
      end

      def redis(&block)
        ::Sidekiq.redis(&block)
      end

      def enqueue(queue_name, klass, hash)
        ::Sidekiq::Client.push('queue' => queue_name, 'class' => klass, 'args' => [hash])
      end

      def enqueue_at(epoch_seconds, queue_name, klass, hash)
        ::Sidekiq::Client.push('queue' => queue_name, 'class' => klass, 'args' => [hash], 'at' => epoch_seconds)
      end

      def setup_heartbeat!(queue_name)
        # TODO: not sure how to do this or what is means to set this up in Sidekiq
        raise NotImplementedError
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
sidekiq-bus-0.5.7 lib/sidekiq_bus/adapter.rb
sidekiq-bus-0.5.6 lib/sidekiq_bus/adapter.rb
sidekiq-bus-0.5.5 lib/sidekiq_bus/adapter.rb
sidekiq-bus-0.5.4 lib/sidekiq_bus/adapter.rb
sidekiq-bus-0.5.3 lib/sidekiq_bus/adapter.rb
sidekiq-bus-0.5.2 lib/sidekiq_bus/adapter.rb