Class: Pwwka::SendMessageAsyncJob

Inherits:
Object
  • Object
show all
Extended by:
Logging
Defined in:
lib/pwwka/send_message_async_job.rb

Constant Summary

Constants included from Logging

Logging::LEVELS

Class Method Summary collapse

Methods included from Logging

logf, logger

Class Method Details

.perform(payload, routing_key, options = {}) ⇒ Object


11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/pwwka/send_message_async_job.rb', line 11

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