class Nsq::Message

Attributes

attempts[R]
body[R]
id[R]

Public Class Methods

new(data, connection) click to toggle source
Calls superclass method Nsq::Frame::new
# File lib/nsq/frames/message.rb, line 10
def initialize(data, connection)
  super
  @timestamp_in_nanoseconds, @attempts, @id, @body = @data.unpack('Q>S>a16a*')
  @body.force_encoding('UTF-8')
end

Public Instance Methods

finish() click to toggle source
# File lib/nsq/frames/message.rb, line 16
def finish
  connection.fin(id)
end
requeue(timeout = 0) click to toggle source
# File lib/nsq/frames/message.rb, line 20
def requeue(timeout = 0)
  connection.req(id, timeout)
end
timestamp() click to toggle source
# File lib/nsq/frames/message.rb, line 28
def timestamp
  Time.at(@timestamp_in_nanoseconds / 1_000_000_000.0)
end
touch() click to toggle source
# File lib/nsq/frames/message.rb, line 24
def touch
  connection.touch(id)
end