Sha256: 95cba81a064bd4e02a76184725919169d254f2b968c0c94d72b489dc3e54d13d
Contents?: true
Size: 838 Bytes
Versions: 2
Compression:
Stored size: 838 Bytes
Contents
module Cloudist class Request attr_reader :queue_header, :qobj, :payload, :start, :headers def initialize(queue, encoded_body, queue_header) @qobj, @queue_header = queue, queue_header @payload = Cloudist::Payload.new(encoded_body, queue_header.headers.dup) @headers = @payload.parse_custom_headers @start = Time.now.utc.to_i end def q qobj.q end def ex qobj.ex end def mq qobj.mq end def age return -1 unless headers[:published_on] start - headers[:published_on] end def ttl headers[:ttl] || -1 end def expired? return false if ttl == -1 age > ttl end def acked? @acked == true end def ack return if acked? queue_header.ack @acked = true end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
cloudist-0.2.1 | lib/cloudist/request.rb |
cloudist-0.2.0 | lib/cloudist/request.rb |