Files
bunnyrun/examples/basic-consumers-example/pong_consumer.rb
2017-10-24 01:10:51 +01:00

21 lines
401 B
Ruby

# frozen_string_literal: true
require 'bunnyrun'
class PongConsumer < BunnyRun::Consumer
queue 'pong'
exchange 'ping-pong', type: :direct
bind 'ping-pong', routing_key: 'pong'
manual_ack true # default is false
def perform(message)
logger.info "#{self.class} received: #{message.payload}"
sleep 1
publish('ping-pong', 'PING', routing_key: 'ping')
message.ack
end
end