class Twirl::Item

Attributes

client[R]

Private: The client that popped the item.

key[R]

Public: The key of the item.

value[R]

Public: The value of the item.

Public Class Methods

new(key, value, client, instrumenter = nil) click to toggle source
# File lib/twirl/item.rb, line 14
def initialize(key, value, client, instrumenter = nil)
  @key = key
  @value = value
  @client = client
  @instrumenter = instrumenter || Instrumenters::Noop
end

Public Instance Methods

==(other)
Alias for: eql?
abort() click to toggle source

Public: Something went wrong processing.

# File lib/twirl/item.rb, line 32
def abort
  @instrumenter.instrument "op.twirl" do |payload|
    payload[:op] = :item_abort
    payload[:queue_name] = @key

    @client.abort @key
  end
end
close() click to toggle source

Public: Acknowledge that we are done processing the item.

# File lib/twirl/item.rb, line 22
def close
  @instrumenter.instrument "op.twirl" do |payload|
    payload[:op] = :item_close
    payload[:queue_name] = @key

    @client.close @key
  end
end
eql?(other) click to toggle source
# File lib/twirl/item.rb, line 41
def eql?(other)
  self.class.eql?(other.class) &&
    @key == other.key &&
    @value == other.value &&
    @client == other.client
end
Also aliased as: ==