Sha256: 7e4517578bb5ffa08fa9f94e0cebb292285bd5491d5b7198a5df8a3d365311d0

Contents?: true

Size: 750 Bytes

Versions: 4

Compression:

Stored size: 750 Bytes

Contents

module Shoryuken
  module Worker
    class InlineExecutor
      class << self
        def perform_async(worker_class, body, options = {})
          body = JSON.dump(body) if body.is_a?(Hash)

          sqs_msg = OpenStruct.new(
            body: body,
            attributes: nil,
            md5_of_body: nil,
            md5_of_message_attributes: nil,
            message_attributes: nil,
            message_id: nil,
            receipt_handle: nil,
            delete: nil
          )

          worker_class.new.perform(sqs_msg, BodyParser.parse(worker_class, sqs_msg))
        end

        def perform_in(worker_class, _interval, body, options = {})
          perform_async(worker_class, body, options)
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
shoryuken-3.2.3 lib/shoryuken/worker/inline_executor.rb
shoryuken-3.2.2 lib/shoryuken/worker/inline_executor.rb
shoryuken-3.2.1 lib/shoryuken/worker/inline_executor.rb
shoryuken-3.2.0 lib/shoryuken/worker/inline_executor.rb