Sha256: 7cf3f658e42ab0f2a2199e0faa7dd4ce77675a8ceb11eec185cda815b84133cb

Contents?: true

Size: 818 Bytes

Versions: 13

Compression:

Stored size: 818 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

13 entries across 13 versions & 1 rubygems

Version Path
pwwka-1.0.0 lib/pwwka/send_message_async_sidekiq_job.rb
pwwka-1.0.0.RC1 lib/pwwka/send_message_async_sidekiq_job.rb
pwwka-0.24.0 lib/pwwka/send_message_async_sidekiq_job.rb
pwwka-0.23.0 lib/pwwka/send_message_async_sidekiq_job.rb
pwwka-0.22.7 lib/pwwka/send_message_async_sidekiq_job.rb
pwwka-0.22.7.RC lib/pwwka/send_message_async_sidekiq_job.rb
pwwka-0.23.0.RC2 lib/pwwka/send_message_async_sidekiq_job.rb
pwwka-0.22.6 lib/pwwka/send_message_async_sidekiq_job.rb
pwwka-0.23.RC1 lib/pwwka/send_message_async_sidekiq_job.rb
pwwka-0.22.5 lib/pwwka/send_message_async_sidekiq_job.rb
pwwka-0.22.4 lib/pwwka/send_message_async_sidekiq_job.rb
pwwka-0.22.3 lib/pwwka/send_message_async_sidekiq_job.rb
pwwka-0.22.2 lib/pwwka/send_message_async_sidekiq_job.rb