Sha256: 492ba7401dd9b2e7a62883d2b482d14c8dc62424d3da264756f348cd49bf7632

Contents?: true

Size: 945 Bytes

Versions: 3

Compression:

Stored size: 945 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 # rubocop:disable Lint/SuppressedException
ensure
  @client.stop timeout: 10, delete: true
end

warn "COUNTER: #{@counter}"

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
msgr-1.3.2 scripts/simple_test.rb
msgr-1.3.1 scripts/simple_test.rb
msgr-1.3.0 scripts/simple_test.rb