On 07/20/2010 09:03 AM, Chris Howard wrote:
Hi,I have a very simple C++ program that attempts to connect to a broker running on localhost: #include "qpid/messaging/Connection.h" #include <iostream> using namespace std; int main(int argc, char* argv[]) { try { qpid::messaging::Connection connection = qpid::messaging::Connection::open("amqp:tcp:localhost:5672"); connection.close(); } catch (qpid::Exception& e) { cout << e.what() << endl; } }
Try catching std::exception. The exception handling has been cleaned up a lot since the 0.6 release (and now the API should only throw subclasses of qpid::types::Exception).
However, if the broker is not running, then the program crashes during the call to Connection::open, rather than throwing a ConnectionException. I see the following output: 2010-07-20 08:45:46 warning Connecting failed: No connection could be made because the target machine actively refused it. : (..\..\..\..\cpp\src\qpid\sys\windows\Socket.cpp:219) 2010-07-20 08:45:46 warning Connection closed Press any key to continue . . . I also see similar behaviour (in a more complicated program) if the broker is closed while a session is in progress. I am using qpid 0.6 and I am running on Windows Vista. Am I doing something wrong?
--------------------------------------------------------------------- Apache Qpid - AMQP Messaging Implementation Project: http://qpid.apache.org Use/Interact: mailto:[email protected]
