Skip to content

Commit

Permalink
close channel aftr publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
carlhoerberg committed Jan 25, 2013
1 parent c59fd92 commit c7d34d0
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions app.rb
Expand Up @@ -18,8 +18,9 @@
post '/publish' do
# publish a message to a fanout exchange
AMQP::Channel.new do |channel|
channel.fanout("f1").publish "Hello, world!"
channel.close
channel.fanout("f1").publish "Hello, world!" do
channel.close
end
end
204
end
Expand All @@ -35,7 +36,7 @@
end

# add a timer to keep the connection alive
timer = EM.add_periodic_timer(2) { out << ":\n" }
timer = EM.add_periodic_timer(20) { out << ":\n" }

# clean up when the user closes the stream
out.callback do
Expand Down

0 comments on commit c7d34d0

Please sign in to comment.