Sha256: 8524d93bec109ab57075ac36508f16a0fc1a885dc16b7e965e37148b097a7c95

Contents?: true

Size: 989 Bytes

Versions: 8

Compression:

Stored size: 989 Bytes

Contents

require "bundler"

Bundler.setup
Bundler.require(:default)

$LOAD_PATH.unshift(File.expand_path("../../../lib", __FILE__))

require "amq/client/adapters/coolio"
require "amq/client/queue"
require "amq/client/exchange"


if RUBY_VERSION.to_s =~ /^1.9/
  Encoding.default_internal = Encoding::UTF_8
  Encoding.default_external = Encoding::UTF_8
end


def amq_client_example(description = "", &block)
  AMQ::Client::CoolioClient.connect(:port => 5672, :vhost => "amq_client_testbed") do |client|
    begin
      puts
      puts
      puts "=============> #{description}"

      block.call(client)
    rescue Interrupt
      warn "Manually interrupted, terminating ..."
    rescue Exception => exception
      STDERR.puts "\n\e[1;31m[#{exception.class}] #{exception.message}\e[0m"
      exception.backtrace.each do |line|
        line = "\e[0;36m#{line}\e[0m" if line.match(Regexp::quote(File.basename(__FILE__)))
        STDERR.puts "  - " + line
      end
    end
  end
  
  cool.io.run
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
amq-client-0.7.0.alpha35 examples/coolio_adapter/example_helper.rb
amq-client-0.7.0.alpha34 examples/coolio_adapter/example_helper.rb
amq-client-0.7.0.alpha33 examples/coolio_adapter/example_helper.rb
amq-client-0.7.0.alpha32 examples/coolio_adapter/example_helper.rb
amq-client-0.7.0.alpha31 examples/coolio_adapter/example_helper.rb
amq-client-0.7.0.alpha30 examples/coolio_adapter/example_helper.rb
amq-client-0.7.0.alpha29 examples/coolio_adapter/example_helper.rb
amq-client-0.7.0.alpha28 examples/coolio_adapter/example_helper.rb