Class: NSQ::Message
- Inherits:
-
Object
- Object
- NSQ::Message
- Defined in:
- lib/nsq/message.rb
Instance Attribute Summary collapse
-
#attempts ⇒ Object
readonly
Returns the value of attribute attempts.
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#connection ⇒ Object
readonly
Returns the value of attribute connection.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
Instance Method Summary collapse
-
#initialize(connection, id, timestamp_high, timestamp_low, attempts, body) ⇒ Message
constructor
A new instance of Message.
- #timestamp ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(connection, id, timestamp_high, timestamp_low, attempts, body) ⇒ Message
Returns a new instance of Message.
5 6 7 8 9 10 11 12 |
# File 'lib/nsq/message.rb', line 5 def initialize(connection, id, , , attempts, body) @connection = connection @id = id @timestamp_high = @timestamp_low = @attempts = attempts @body = body end |
Instance Attribute Details
#attempts ⇒ Object (readonly)
Returns the value of attribute attempts.
3 4 5 |
# File 'lib/nsq/message.rb', line 3 def attempts @attempts end |
#body ⇒ Object (readonly)
Returns the value of attribute body.
3 4 5 |
# File 'lib/nsq/message.rb', line 3 def body @body end |
#connection ⇒ Object (readonly)
Returns the value of attribute connection.
3 4 5 |
# File 'lib/nsq/message.rb', line 3 def connection @connection end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
3 4 5 |
# File 'lib/nsq/message.rb', line 3 def id @id end |
Instance Method Details
#timestamp ⇒ Object
14 15 16 17 18 |
# File 'lib/nsq/message.rb', line 14 def # TODO: Not really a nanosecond timestamp #Time.at((@timestamp_high * 2**32 + @timestamp_low) / 1000000000.0) Time.at(@timestamp_low) end |
#to_s ⇒ Object
20 21 22 |
# File 'lib/nsq/message.rb', line 20 def to_s "#{connection} id=#{id} timestamp=#{} attempts=#{attempts} body=#{body}" end |