Class: MarchHare::Headers

Inherits:
Object
  • Object
show all
Defined in:
lib/march_hare/metadata.rb

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (Headers) initialize(channel, consumer_tag, envelope, properties)

A new instance of Headers



5
6
7
8
9
10
# File 'lib/march_hare/metadata.rb', line 5

def initialize(channel, consumer_tag, envelope, properties)
  @channel      = channel
  @consumer_tag = consumer_tag
  @envelope     = envelope
  @properties   = properties
end

Instance Attribute Details

- (Object) channel (readonly)

Returns the value of attribute channel



3
4
5
# File 'lib/march_hare/metadata.rb', line 3

def channel
  @channel
end

- (Object) consumer_tag (readonly)

Returns the value of attribute consumer_tag



3
4
5
# File 'lib/march_hare/metadata.rb', line 3

def consumer_tag
  @consumer_tag
end

- (Object) envelope (readonly)

Returns the value of attribute envelope



3
4
5
# File 'lib/march_hare/metadata.rb', line 3

def envelope
  @envelope
end

- (Object) properties (readonly)

Returns the value of attribute properties



3
4
5
# File 'lib/march_hare/metadata.rb', line 3

def properties
  @properties
end

Instance Method Details

- (Object) ack(options = {})



12
13
14
# File 'lib/march_hare/metadata.rb', line 12

def ack(options={})
  @channel.basic_ack(delivery_tag, options.fetch(:multiple, false))
end

- (Object) delivery_tag



32
33
34
# File 'lib/march_hare/metadata.rb', line 32

def delivery_tag
  @delivery_tag ||= VersionedDeliveryTag.new(@envelope.delivery_tag, @channel.recoveries_counter.get)
end

- (Boolean) persistent?

Returns:

  • (Boolean)


58
59
60
# File 'lib/march_hare/metadata.rb', line 58

def persistent?
  delivery_mode == 2
end

- (Boolean) redelivered?

Returns:

  • (Boolean)


62
63
64
# File 'lib/march_hare/metadata.rb', line 62

def redelivered?
  redeliver
end

- (Boolean) redelivery?

Returns:

  • (Boolean)


66
67
68
# File 'lib/march_hare/metadata.rb', line 66

def redelivery?
  redeliver
end

- (Object) reject(options = {})



16
17
18
# File 'lib/march_hare/metadata.rb', line 16

def reject(options={})
  @channel.basic_reject(delivery_tag, options.fetch(:requeue, false))
end