Sha256: f78f7b3e411e3f525f9f52636c3fe6f3f8e3b1bc2c5f5d0c4116a932a46d601d

Contents?: true

Size: 843 Bytes

Versions: 1

Compression:

Stored size: 843 Bytes

Contents

# frozen_string_literal: true

module Karafka
  module Backends
    # Sidekiq backend that schedules stuff to Sidekiq worker for delayed execution
    module Sidekiq
      # Karafka Sidekiq backend version
      VERSION = '1.1.0.alpha1'

      private

      # Enqueues the execution of perform method into a worker.
      # @note Each worker needs to have a class #perform_async method that will allow us to pass
      #   parameters into it. We always pass topic as a first argument and this request
      #   params_batch as a second one (we pass topic to be able to build back the controller
      #   in the worker)
      def process
        Karafka.monitor.notice(self.class, params_batch)
        topic.worker.perform_async(
          topic.id,
          topic.interchanger.load(params_batch.to_a)
        )
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
karafka-sidekiq-backend-1.1.0.alpha1 lib/karafka/backends/sidekiq.rb