Class: CrystalMQ::Producer::ProducerPayload

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(topic, message) ⇒ ProducerPayload

Returns a new instance of ProducerPayload.



76
77
78
79
# File 'lib/crystalmq.rb', line 76

def initialize(topic, message)
  @topic = topic
  @message = message
end

Instance Attribute Details

#messageObject (readonly)

Returns the value of attribute message.



74
75
76
# File 'lib/crystalmq.rb', line 74

def message
  @message
end

#topicObject (readonly)

Returns the value of attribute topic.



74
75
76
# File 'lib/crystalmq.rb', line 74

def topic
  @topic
end

Class Method Details

.from_msgpack(h) ⇒ Object



85
86
87
88
# File 'lib/crystalmq.rb', line 85

def self.from_msgpack h
  @topic = h["topic"]
  @message = h["message"]
end

Instance Method Details

#to_msgpackObject



81
82
83
# File 'lib/crystalmq.rb', line 81

def to_msgpack
  { "topic" => @topic, "message" => @message }.to_msgpack
end