Sha256: 0adeab110de10eee74a3b1854cd4a4b6a0302128de545382fbaf4d65b0335f46

Contents?: true

Size: 872 Bytes

Versions: 15

Compression:

Stored size: 872 Bytes

Contents

$:.unshift File.join File.dirname(__FILE__), '../lib'
require 'msgr'

Msgr.logger.level = Logger::Severity::INFO

class TestConsumer < Msgr::Consumer
  def index
    log(:info) { payload }
  end

  def another_action
    log(:info) { payload }
  end

  def log_name
    "<TestConsumer##{action}>"
  end
end

#
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 "Message #{i} #{rand}", to: 'abc.XXX'
end

begin
  sleep
rescue Interrupt
ensure
  @client.stop timeout: 10, delete: true
end

$stderr.puts "COUNTER: #{@counter}"

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
msgr-0.14.1.1.b125 scripts/simple_test.rb
msgr-0.14.1.1.b124 scripts/simple_test.rb
msgr-0.14.1.1.b112 scripts/simple_test.rb
msgr-0.14.1.1.b111 scripts/simple_test.rb
msgr-0.14.1.1.b110 scripts/simple_test.rb
msgr-0.14.1 scripts/simple_test.rb
msgr-0.14.0 scripts/simple_test.rb
msgr-0.13.0 scripts/simple_test.rb
msgr-0.12.3 scripts/simple_test.rb
msgr-0.12.2 scripts/simple_test.rb
msgr-0.12.1 scripts/simple_test.rb
msgr-0.12.0 scripts/simple_test.rb
msgr-0.11.1 scripts/simple_test.rb
msgr-0.11.0 scripts/simple_test.rb
msgr-0.11.0.rc3 scripts/simple_test.rb