Sha256: 008f0a6532e738525fc6c8df339cf27b9dd239eb005387a63fa42f76b1022e50

Contents?: true

Size: 1.08 KB

Versions: 32

Compression:

Stored size: 1.08 KB

Contents

# encoding: utf-8

require "bundler"

Bundler.setup
Bundler.require(:default)

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

require "amq/client/adapters/event_machine"
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)
  EM.run do
    AMQ::Client::EventMachineClient.connect(:port => 5672, :vhost => "amq_client_testbed", :frame_max => 65536, :heartbeat_interval => 1) 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
  end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
amq-client-1.0.4 examples/eventmachine_adapter/example_helper.rb
amq-client-1.0.3 examples/eventmachine_adapter/example_helper.rb
amq-client-1.1.0.pre1 examples/eventmachine_adapter/example_helper.rb
amq-client-1.0.2 examples/eventmachine_adapter/example_helper.rb
amq-client-1.0.1 examples/eventmachine_adapter/example_helper.rb
amq-client-1.0.0 examples/eventmachine_adapter/example_helper.rb
amq-client-0.9.12 examples/eventmachine_adapter/example_helper.rb
amq-client-0.9.11 examples/eventmachine_adapter/example_helper.rb
amq-client-0.9.10 examples/eventmachine_adapter/example_helper.rb
amq-client-0.9.9 examples/eventmachine_adapter/example_helper.rb
amq-client-0.9.8 examples/eventmachine_adapter/example_helper.rb
amq-client-0.9.7 examples/eventmachine_adapter/example_helper.rb
amq-client-0.9.6 examples/eventmachine_adapter/example_helper.rb
amq-client-0.9.5 examples/eventmachine_adapter/example_helper.rb
amq-client-0.9.4 examples/eventmachine_adapter/example_helper.rb
amq-client-1.0.0.pre2 examples/eventmachine_adapter/example_helper.rb
amq-client-0.9.3 examples/eventmachine_adapter/example_helper.rb
amq-client-1.0.0.pre1 examples/eventmachine_adapter/example_helper.rb
amq-client-0.9.2 examples/eventmachine_adapter/example_helper.rb
amq-client-0.9.1 examples/eventmachine_adapter/example_helper.rb