-
-
Save mediaslave24/c3fc881e8c5b5e4d24e2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$:.unshift File.expand_path('~/amqp/lib') | |
require 'amqp' | |
Thread.new { EM.run } | |
sleep 0.01 until EM.reactor_running? | |
qname = 'some-queue-name' | |
connection = AMQP.connect | |
channel = connection.channel | |
channel | |
.queue(qname, auto_delete: true) | |
.tap(&:purge) | |
.subscribe(ack: false) do |metadata, payload| | |
raise 'manual exception' | |
metadata.reject(requeue: true) | |
end | |
100.times do |n| | |
channel.default_exchange.publish(n.to_s, routing_key: qname) | |
end | |
EM.error_handler do |ex| | |
puts "#{ex.class}: #{ex.message}" | |
if ex.message =~ /method_class/ | |
puts 'ERROR. Bug reproduced' | |
exit 1 | |
end | |
end | |
EM.add_timer(5) { puts 'OK. Bug not reproduced'; exit 0 } | |
EM.reactor_thread.join |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment