Class: Nsq::Message
Instance Attribute Summary collapse
-
#attempts ⇒ Object
readonly
Returns the value of attribute attempts.
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#timestamp ⇒ Object
readonly
Returns the value of attribute timestamp.
Attributes inherited from Frame
Instance Method Summary collapse
- #finish ⇒ Object
-
#initialize(data, connection) ⇒ Message
constructor
A new instance of Message.
- #requeue(timeout = 0) ⇒ Object
- #touch ⇒ Object
Methods included from AttributeLogger
Constructor Details
#initialize(data, connection) ⇒ Message
Returns a new instance of Message.
11 12 13 14 15 |
# File 'lib/nsq/frames/message.rb', line 11 def initialize(data, connection) super , @attempts, @id, @body = @data.unpack('Q>s>a16a*') @body.force_encoding('UTF-8') end |
Instance Attribute Details
#attempts ⇒ Object (readonly)
Returns the value of attribute attempts.
7 8 9 |
# File 'lib/nsq/frames/message.rb', line 7 def attempts @attempts end |
#body ⇒ Object (readonly)
Returns the value of attribute body.
9 10 11 |
# File 'lib/nsq/frames/message.rb', line 9 def body @body end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
8 9 10 |
# File 'lib/nsq/frames/message.rb', line 8 def id @id end |
#timestamp ⇒ Object (readonly)
Returns the value of attribute timestamp.
6 7 8 |
# File 'lib/nsq/frames/message.rb', line 6 def end |
Instance Method Details
#finish ⇒ Object
17 18 19 |
# File 'lib/nsq/frames/message.rb', line 17 def finish connection.fin(id) end |
#requeue(timeout = 0) ⇒ Object
21 22 23 |
# File 'lib/nsq/frames/message.rb', line 21 def requeue(timeout = 0) connection.req(id, timeout) end |
#touch ⇒ Object
25 26 27 |
# File 'lib/nsq/frames/message.rb', line 25 def touch connection.touch(id) end |