Sha256: 0dcd3c770ba57937c3c3048406f3d5bbe1d14c4693646da786713eb5305b5b52

Contents?: true

Size: 947 Bytes

Versions: 63

Compression:

Stored size: 947 Bytes

Contents

#!/usr/bin/env ruby
# encoding: utf-8

require "bundler"
Bundler.setup

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

require 'amqp'


puts "=> Authentication failure handling with a callback"
puts

handler             = Proc.new { |settings| puts "Failed to connect, as expected"; EM.stop }
connection_settings = {
  :port     => 5672,
  :vhost    => "/amq_client_testbed",
  :user     => "amq_client_gem",
  :password => "amq_client_gem_password_that_is_incorrect #{Time.now.to_i}",
  :timeout        => 0.3,
  :on_tcp_connection_failure => handler,
  :on_possible_authentication_failure => Proc.new { |settings|
                                            puts "Authentication failed, as expected, settings are: #{settings.inspect}"

                                            EM.stop
                                          }
}


AMQP.start(connection_settings) do |connection, open_ok|
  raise "This should not be reachable"
end

Version data entries

63 entries across 63 versions & 1 rubygems

Version Path
amqp-1.8.0 examples/error_handling/handling_authentication_failure_with_a_callback.rb
amqp-1.7.0 examples/error_handling/handling_authentication_failure_with_a_callback.rb
amqp-1.6.0 examples/error_handling/handling_authentication_failure_with_a_callback.rb
amqp-1.5.3 examples/error_handling/handling_authentication_failure_with_a_callback.rb
amqp-1.5.2 examples/error_handling/handling_authentication_failure_with_a_callback.rb
amqp-1.5.1 examples/error_handling/handling_authentication_failure_with_a_callback.rb
amqp-1.5.0 examples/error_handling/handling_authentication_failure_with_a_callback.rb
amqp-1.4.2 examples/error_handling/handling_authentication_failure_with_a_callback.rb
amqp-1.4.1 examples/error_handling/handling_authentication_failure_with_a_callback.rb
amqp-1.4.0 examples/error_handling/handling_authentication_failure_with_a_callback.rb
amqp-1.3.0 examples/error_handling/handling_authentication_failure_with_a_callback.rb
amqp-1.2.1 examples/error_handling/handling_authentication_failure_with_a_callback.rb
amqp-1.2.0 examples/error_handling/handling_authentication_failure_with_a_callback.rb
amqp-1.1.8 examples/error_handling/handling_authentication_failure_with_a_callback.rb
amqp-1.1.7 examples/error_handling/handling_authentication_failure_with_a_callback.rb
amqp-1.1.6 examples/error_handling/handling_authentication_failure_with_a_callback.rb
amqp-1.1.5 examples/error_handling/handling_authentication_failure_with_a_callback.rb
amqp-1.1.4 examples/error_handling/handling_authentication_failure_with_a_callback.rb
amqp-1.1.3 examples/error_handling/handling_authentication_failure_with_a_callback.rb
amqp-1.0.4 examples/error_handling/handling_authentication_failure_with_a_callback.rb