Class: PulsarSdk::Producer::Message
- Inherits:
-
Object
- Object
- PulsarSdk::Producer::Message
- Includes:
- Tweaks::CleanInspect
- Defined in:
- lib/pulsar_sdk/producer/message.rb
Instance Attribute Summary collapse
-
#key ⇒ Object
Returns the value of attribute key.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
Instance Method Summary collapse
- #binary_string ⇒ Object
-
#initialize(msg, metadata = nil, key = nil) ⇒ Message
constructor
A new instance of Message.
- #producer_name=(v) ⇒ Object
- #sequence_id=(v) ⇒ Object
Methods included from Tweaks::CleanInspect
Constructor Details
#initialize(msg, metadata = nil, key = nil) ⇒ Message
Returns a new instance of Message.
8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/pulsar_sdk/producer/message.rb', line 8 def initialize(msg, = nil, key = nil) # TODO check metadata type , = msg, ||= Pulsar::Proto::MessageMetadata.new # msg must convet to string json_encode! unless .is_a?(String) publish_time = .publish_time .publish_time = publish_time.zero? ? TimeX.now. : publish_time self.key = key end |
Instance Attribute Details
#key ⇒ Object
Returns the value of attribute key.
6 7 8 |
# File 'lib/pulsar_sdk/producer/message.rb', line 6 def key @key end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
6 7 8 |
# File 'lib/pulsar_sdk/producer/message.rb', line 6 def end |
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata.
6 7 8 |
# File 'lib/pulsar_sdk/producer/message.rb', line 6 def end |
Instance Method Details
#binary_string ⇒ Object
30 31 32 |
# File 'lib/pulsar_sdk/producer/message.rb', line 30 def binary_string .bytes.pack('C*') end |
#producer_name=(v) ⇒ Object
22 23 24 |
# File 'lib/pulsar_sdk/producer/message.rb', line 22 def producer_name=(v) .producer_name = v end |
#sequence_id=(v) ⇒ Object
26 27 28 |
# File 'lib/pulsar_sdk/producer/message.rb', line 26 def sequence_id=(v) .sequence_id = v end |