Sha256: 991c042918a57540ecdb3a840f5b55d7838ecaa3b40f0ca9d80915d2d134654f

Contents?: true

Size: 819 Bytes

Versions: 1

Compression:

Stored size: 819 Bytes

Contents

begin
  require 'sidekiq'
rescue LoadError
end

module Pwwka
  class SendMessageAsyncSidekiqJob
    begin
      include Sidekiq::Worker
      extend Pwwka::Logging

      sidekiq_options queue: 'pwwka_send_message_async', retry: 3

      def perform(payload, routing_key, options = {})
        type = options["type"]
        message_id = options["message_id"] || "auto_generate"
        headers = options["headers"]

        logger.info("Sending message async #{routing_key}, #{payload}")

        message_id = message_id.to_sym if message_id == "auto_generate"

        Pwwka::Transmitter.send_message!(
          payload,
          routing_key,
          type: type,
          message_id: message_id,
          headers: headers,
          on_error: :raise,
        )
      end
    rescue NameError
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pwwka-0.22.2.RC4 lib/pwwka/send_message_async_sidekiq_job.rb