Created
June 9, 2011 07:13
-
-
Save michaelklishin/1016238 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env ruby | |
| # encoding: utf-8 | |
| require "rubygems" | |
| require "amqp" | |
| puts "=> TCP connection failure handling with a rescue statement" | |
| puts | |
| connection_settings = { | |
| :port => 9689, | |
| :vhost => "/amq_client_testbed", | |
| :user => "amq_client_gem", | |
| :password => "amq_client_gem_password", | |
| :timeout => 0.3 | |
| } | |
| begin | |
| AMQP.start(connection_settings) do |connection, open_ok| | |
| raise "This should not be reachable" | |
| end | |
| rescue AMQP::TCPConnectionFailed => e | |
| puts "Caught AMQP::TCPConnectionFailed => TCP connection failed, as expected." | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment