Class: PikaQue::Handlers::DefaultHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/pika_que/handlers/default_handler.rb

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ DefaultHandler

Returns a new instance of DefaultHandler.



5
6
7
# File 'lib/pika_que/handlers/default_handler.rb', line 5

def initialize(opts = {})
  # nothing to do here
end

Instance Method Details

#bind_queue(queue, routing_key) ⇒ Object



9
10
# File 'lib/pika_que/handlers/default_handler.rb', line 9

def bind_queue(queue, routing_key)
end

#closeObject



26
27
# File 'lib/pika_que/handlers/default_handler.rb', line 26

def close
end

#handle(response_code, channel, delivery_info, metadata, msg, error = nil) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/pika_que/handlers/default_handler.rb', line 12

def handle(response_code, channel, delivery_info, , msg, error = nil)
  case response_code
  when :ack
    PikaQue.logger.debug "DefaultHandler acknowledge <#{msg}>"
    channel.acknowledge(delivery_info.delivery_tag, false)
  when :requeue
    PikaQue.logger.debug "DefaultHandler requeue <#{msg}>"
    channel.reject(delivery_info.delivery_tag, true)
  else
    PikaQue.logger.debug "DefaultHandler reject <#{msg}>"
    channel.reject(delivery_info.delivery_tag, false)
  end
end