Class: Pheromone::Messaging::Message
- Inherits:
-
Object
- Object
- Pheromone::Messaging::Message
- Defined in:
- lib/pheromone/messaging/message.rb
Instance Attribute Summary collapse
-
#blob ⇒ Object
readonly
Returns the value of attribute blob.
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#topic ⇒ Object
readonly
Returns the value of attribute topic.
Instance Method Summary collapse
-
#initialize(topic:, blob:, metadata: {}, options: {}, encoder:, message_format:, embed_blob:) ⇒ Message
constructor
A new instance of Message.
- #send! ⇒ Object
Constructor Details
#initialize(topic:, blob:, metadata: {}, options: {}, encoder:, message_format:, embed_blob:) ⇒ Message
Returns a new instance of Message.
5 6 7 8 9 10 11 12 13 |
# File 'lib/pheromone/messaging/message.rb', line 5 def initialize(topic:, blob:, metadata: {}, options: {}, encoder:, message_format:, embed_blob:) @topic = topic @blob = blob @options = || {} @metadata = || {} @encoder = encoder @message_format = @embed_blob = end |
Instance Attribute Details
#blob ⇒ Object (readonly)
Returns the value of attribute blob.
15 16 17 |
# File 'lib/pheromone/messaging/message.rb', line 15 def blob @blob end |
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata.
15 16 17 |
# File 'lib/pheromone/messaging/message.rb', line 15 def @metadata end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
15 16 17 |
# File 'lib/pheromone/messaging/message.rb', line 15 def @options end |
#topic ⇒ Object (readonly)
Returns the value of attribute topic.
15 16 17 |
# File 'lib/pheromone/messaging/message.rb', line 15 def topic @topic end |
Instance Method Details
#send! ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/pheromone/messaging/message.rb', line 17 def send! WaterDrop::SyncProducer.call( MessageFormatter.new( , @encoder, @message_format ).format, { topic: topic.to_s }.merge!() ) end |