Sha256: c2c487cf4debac40bccd87341a916580b367f6f47c7a94ad8b5fa2c3011ceeb1

Contents?: true

Size: 912 Bytes

Versions: 91

Compression:

Stored size: 912 Bytes

Contents

# frozen_string_literal: true

$LOAD_PATH.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

91 entries across 91 versions & 1 rubygems

Version Path
msgr-1.2.0 scripts/simple_test.rb
msgr-1.1.0.1.b306 scripts/simple_test.rb
msgr-1.1.0.1.b305 scripts/simple_test.rb
msgr-1.1.0.1.b302 scripts/simple_test.rb
msgr-1.1.0.1.b301 scripts/simple_test.rb
msgr-1.1.0.1.b300 scripts/simple_test.rb
msgr-1.1.0.1.b297 scripts/simple_test.rb
msgr-1.1.0.1.b296 scripts/simple_test.rb
msgr-1.1.0.1.b295 scripts/simple_test.rb
msgr-1.1.0.1.b292 scripts/simple_test.rb
msgr-1.1.0.1.b291 scripts/simple_test.rb
msgr-1.1.0.1.b288 scripts/simple_test.rb
msgr-1.1.0.1.b285 scripts/simple_test.rb
msgr-1.1.0.1.b263 scripts/simple_test.rb
msgr-1.1.0.1.b249 scripts/simple_test.rb
msgr-1.1.0.1.b248 scripts/simple_test.rb
msgr-1.1.0.1.b244 scripts/simple_test.rb
msgr-1.1.0.1.b241 scripts/simple_test.rb
msgr-1.1.0.1.b240 scripts/simple_test.rb
msgr-1.1.0.1.b239 scripts/simple_test.rb