Class: Warren::QueueBroadcastMessage

Inherits:
Object
  • Object
show all
Defined in:
lib/warren/queue_broadcast_message.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(record) ⇒ QueueBroadcastMessage


4
5
6
# File 'lib/warren/queue_broadcast_message.rb', line 4

def initialize(record)
  @record = record
end

Instance Attribute Details

#recordObject (readonly)

Returns the value of attribute record


2
3
4
# File 'lib/warren/queue_broadcast_message.rb', line 2

def record
  @record
end

Instance Method Details

#payloadObject


12
13
14
# File 'lib/warren/queue_broadcast_message.rb', line 12

def payload
  [record.class.name, record.id].to_json
end

#routing_keyObject


8
9
10
# File 'lib/warren/queue_broadcast_message.rb', line 8

def routing_key
  "#{Rails.env}.queue_broadcast.#{record.class.name.underscore}.#{record.id}"
end