/usr/share/doc/ruby-amqp/examples/rack/publish_a_message_on_request/thin.ru is in ruby-amqp 0.9.5-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | use Rack::CommonLogger
require "bundler"
Bundler.setup
$:.unshift(File.expand_path("../../../../lib", __FILE__))
require 'amqp'
require 'amqp/utilities/event_loop_helper'
puts "EventMachine.reactor_running? => #{EventMachine.reactor_running?.inspect}"
AMQP::Utilities::EventLoopHelper.run do
AMQP.start
exchange = AMQP.channel.fanout("amq.fanout")
q = AMQP.channel.queue("", :auto_delete => true, :exclusive => true)
q.bind(exchange)
AMQP::channel.default_exchange.publish("Started!", :routing_key => q.name)
end
app = proc do |env|
AMQP.channel.fanout("amq.fanout").publish("Served a request at (#{Time.now.to_i})")
[
200, # Status code
{ # Response headers
'Content-Type' => 'text/html',
'Content-Length' => '2',
},
['hi'] # Response body
]
end
run app
|