Class: Pheromone::Messaging::Message

Inherits:
Object
  • Object
show all
Defined in:
lib/pheromone/messaging/message.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(topic:, blob:, metadata: {}, options: {}) ⇒ Message

Returns a new instance of Message.



5
6
7
8
9
10
# File 'lib/pheromone/messaging/message.rb', line 5

def initialize(topic:, blob:, metadata: {}, options: {})
  @topic = topic
  @blob = blob
  @options = options || {}
   =  || {}
end

Instance Attribute Details

#blobObject (readonly)

Returns the value of attribute blob.



12
13
14
# File 'lib/pheromone/messaging/message.rb', line 12

def blob
  @blob
end

#metadataObject (readonly)

Returns the value of attribute metadata.



12
13
14
# File 'lib/pheromone/messaging/message.rb', line 12

def 
  
end

#optionsObject (readonly)

Returns the value of attribute options.



12
13
14
# File 'lib/pheromone/messaging/message.rb', line 12

def options
  @options
end

#topicObject (readonly)

Returns the value of attribute topic.



12
13
14
# File 'lib/pheromone/messaging/message.rb', line 12

def topic
  @topic
end

Instance Method Details

#send!Object



14
15
16
17
18
19
# File 'lib/pheromone/messaging/message.rb', line 14

def send!
  WaterDrop::SyncProducer.call(
    MessageFormatter.new(full_message).format,
    { topic: topic.to_s }.merge!(options)
  )
end