Sha256: beeeec76477fdc882662c4e863eafc5025af41b36ab9398945699ba3f3f8c458

Contents?: true

Size: 786 Bytes

Versions: 42

Compression:

Stored size: 786 Bytes

Contents

module Pwwka
  class SendMessageAsyncJob

    extend Pwwka::Logging

    @queue = 'pwwka_send_message_async'

    extend Resque::Plugins::ExponentialBackoff rescue nil # Optional
    @backoff_strategy = Pwwka.configuration.send_message_resque_backoff_strategy

    def self.perform(payload, routing_key, options = {})

      type       = options["type"]
      message_id = options["message_id"] || "auto_generate"
      headers    = options["headers"]

      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

42 entries across 42 versions & 1 rubygems

Version Path
pwwka-1.0.0 lib/pwwka/send_message_async_job.rb
pwwka-1.0.0.RC1 lib/pwwka/send_message_async_job.rb
pwwka-0.24.0 lib/pwwka/send_message_async_job.rb
pwwka-0.23.0 lib/pwwka/send_message_async_job.rb
pwwka-0.22.7 lib/pwwka/send_message_async_job.rb
pwwka-0.22.7.RC lib/pwwka/send_message_async_job.rb
pwwka-0.23.0.RC2 lib/pwwka/send_message_async_job.rb
pwwka-0.22.6 lib/pwwka/send_message_async_job.rb
pwwka-0.23.RC1 lib/pwwka/send_message_async_job.rb
pwwka-0.22.5 lib/pwwka/send_message_async_job.rb
pwwka-0.22.4 lib/pwwka/send_message_async_job.rb
pwwka-0.22.3 lib/pwwka/send_message_async_job.rb
pwwka-0.22.2 lib/pwwka/send_message_async_job.rb
pwwka-0.21.3 lib/pwwka/send_message_async_job.rb
pwwka-0.22.2.RC4 lib/pwwka/send_message_async_job.rb
pwwka-0.22.2.RC3 lib/pwwka/send_message_async_job.rb
pwwka-0.22.2.RC2 lib/pwwka/send_message_async_job.rb
pwwka-0.22.0.RC2 lib/pwwka/send_message_async_job.rb
pwwka-0.22.0.RC lib/pwwka/send_message_async_job.rb
pwwka-0.21.2 lib/pwwka/send_message_async_job.rb