Class: ActivePubsub::Event

Inherits:
Object
  • Object
show all
Includes:
ActiveAttr::Model, ActiveModel::AttributeMethods
Defined in:
lib/active_pubsub/event.rb

Instance Method Summary collapse

Constructor Details

#initialize(exchange, name, record) ⇒ Event

attributes have to be set for purposes of marshaling



17
18
19
20
21
22
23
24
25
# File 'lib/active_pubsub/event.rb', line 17

def initialize(exchange, name, record)
  self[:exchange] = exchange
  self[:name] = name
  self[:record] = record
  self[:id] = ::SecureRandom.hex
  self[:record_type] = record.class.name
  self[:occured_at] ||= ::DateTime.now
  self[:routing_key] ||= [exchange, name].join('.')
end