Proper SIGINT handling from ruby rpc_server

This commit is contained in:
Marek Majkowski 2011-07-07 17:01:28 +01:00
parent e4b167cc0e
commit b0a44e3b4e

View File

@ -12,6 +12,12 @@ AMQP.start(:host => "localhost") do |connection|
channel = AMQP::Channel.new(connection)
queue = channel.queue("rpc_queue")
Signal.trap("INT") do
connection.close do
EM.stop { exit }
end
end
channel.prefetch(1)
queue.subscribe(:ack => true) do |header, body|