Class: MQ::Header

Inherits:
Object
  • Object
show all
Includes:
AMQP
Defined in:
lib/mq/header.rb

Constant Summary

Constants included from AMQP

AMQP::FIELDS, AMQP::HEADER, AMQP::PORT, AMQP::RESPONSES, AMQP::VERSION, AMQP::VERSION_MAJOR, AMQP::VERSION_MINOR

Instance Method Summary collapse

Methods included from AMQP

client, client=, connect, fork, settings, start, stop

Constructor Details

#initialize(mq, header_obj) ⇒ Header

Returns a new instance of Header.



5
6
7
8
# File 'lib/mq/header.rb', line 5

def initialize(mq, header_obj)
  @mq = mq
  @header = header_obj
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(meth, *args, &blk) ⇒ Object



25
26
27
# File 'lib/mq/header.rb', line 25

def method_missing meth, *args, &blk
  @header.send meth, *args, &blk
end

Instance Method Details

#ackObject

Acknowledges the receipt of this message with the server.



11
12
13
14
15
# File 'lib/mq/header.rb', line 11

def ack
  @mq.callback{
    @mq.send Protocol::Basic::Ack.new(:delivery_tag => properties[:delivery_tag])
  }
end

#inspectObject



29
30
31
# File 'lib/mq/header.rb', line 29

def inspect
  @header.inspect
end

#reject(opts = {}) ⇒ Object

Reject this message (XXX currently unimplemented in rabbitmq)

  • :requeue => true | false (default false)



19
20
21
22
23
# File 'lib/mq/header.rb', line 19

def reject opts = {}
  @mq.callback{
    @mq.send Protocol::Basic::Reject.new(opts.merge(:delivery_tag => properties[:delivery_tag]))
  }
end