scripts/simple_test.rb in msgr-0.10.2 vs scripts/simple_test.rb in msgr-0.11.0.rc1
- old
+ new
@@ -1,5 +1,6 @@
+$:.unshift File.join File.dirname(__FILE__), '../lib'
require 'msgr'
Msgr.logger.level = Logger::Severity::INFO
class TestConsumer < Msgr::Consumer
@@ -14,25 +15,38 @@
def log_name
"<TestConsumer##{action}>"
end
end
-@client = Msgr::Client.new user: 'guest', password: 'guest', size: 1
+#
+class NullPool
+ def initialize(*)
+ end
+ def post(*args)
+ yield(*args)
+ end
+end
+
+@client = Msgr::Client.new user: 'guest', password: 'guest',
+ max: 4#, pool_class: NullPool
+
@client.routes.configure do
route 'abc.#', to: 'test#index'
route 'cde.#', to: 'test#index'
route '#', to: 'test#another_action'
end
@client.start
100.times do |i|
- @client.publish 'abc.XXX', "Message #{i} #{rand}"
+ @client.publish "Message #{i} #{rand}", to: 'abc.XXX'
end
begin
sleep
rescue Interrupt
ensure
- @client.stop timeout: 10
+ @client.stop timeout: 10, delete: true
end
+
+$stderr.puts "COUNTER: #{@counter}"