Sha256: c2bea83d8c9c32380fcd437bc12de1d06a16b71becfc306ebfd974d603b5d1fb

Contents?: true

Size: 1.06 KB

Versions: 28

Compression:

Stored size: 1.06 KB

Contents

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

28 entries across 28 versions & 1 rubygems

Version Path
amq-client-0.7.0.alpha27 examples/eventmachine_adapter/example_helper.rb
amq-client-0.7.0.alpha26 examples/eventmachine_adapter/example_helper.rb
amq-client-0.7.0.alpha25 examples/eventmachine_adapter/example_helper.rb
amq-client-0.7.0.alpha24 examples/eventmachine_adapter/example_helper.rb
amq-client-0.7.0.alpha23 examples/eventmachine_adapter/example_helper.rb
amq-client-0.7.0.alpha22 examples/eventmachine_adapter/example_helper.rb
amq-client-0.7.0.alpha21 examples/eventmachine_adapter/example_helper.rb
amq-client-0.7.0.alpha20 examples/eventmachine_adapter/example_helper.rb
amq-client-0.7.0.alpha19 examples/eventmachine_adapter/example_helper.rb
amq-client-0.7.0.alpha18 examples/eventmachine_adapter/example_helper.rb
amq-client-0.7.0.alpha17 examples/eventmachine_adapter/example_helper.rb
amq-client-0.7.0.alpha16 examples/eventmachine_adapter/example_helper.rb
amq-client-0.7.0.alpha15 examples/eventmachine_adapter/example_helper.rb
amq-client-0.7.0.alpha14 examples/eventmachine_adapter/example_helper.rb
amq-client-0.7.0.alpha13 examples/eventmachine_adapter/example_helper.rb
amq-client-0.7.0.alpha12 examples/eventmachine_adapter/example_helper.rb
amq-client-0.7.0.alpha11 examples/eventmachine_adapter/example_helper.rb
amq-client-0.7.0.alpha10 examples/eventmachine_adapter/example_helper.rb
amq-client-0.7.0.alpha9 examples/eventmachine_adapter/example_helper.rb
amq-client-0.7.0.alpha8 examples/eventmachine_adapter/example_helper.rb