Sha256: e98ed81678bb2748e968a59106fd6569a21195e4b7f41ce3b0cc59670273c9c8

Contents?: true

Size: 714 Bytes

Versions: 2

Compression:

Stored size: 714 Bytes

Contents

require 'sidekiq'

module Pwwka
  class SendMessageAsyncSidekiqJob
    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
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pwwka-0.21.3 lib/pwwka/send_message_async_sidekiq_job.rb
pwwka-0.22.0.RC2 lib/pwwka/send_message_async_sidekiq_job.rb