You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2008/12/11 15:18:15 UTC

svn commit: r725692 - /activemq/activemq-cpp/trunk/src/examples/topics/chat/Chat.cpp

Author: tabish
Date: Thu Dec 11 06:18:15 2008
New Revision: 725692

URL: http://svn.apache.org/viewvc?rev=725692&view=rev
Log:
https://issues.apache.org/activemq/browse/AMQCPP-212

Update sample to display a better error when the broker can't be contacted.

Modified:
    activemq/activemq-cpp/trunk/src/examples/topics/chat/Chat.cpp

Modified: activemq/activemq-cpp/trunk/src/examples/topics/chat/Chat.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/examples/topics/chat/Chat.cpp?rev=725692&r1=725691&r2=725692&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/examples/topics/chat/Chat.cpp (original)
+++ activemq/activemq-cpp/trunk/src/examples/topics/chat/Chat.cpp Thu Dec 11 06:18:15 2008
@@ -77,6 +77,15 @@
         this->connection.reset(
             connectionFactory->createConnection( this->getUsername(), this->getPassword() ) );
 
+    } catch( cms::CMSException& ex ) {
+        std::cout << "==================================================" << std::endl;
+        std::cout << "= Failed to Connect To Broker, Is it Running?    =" << std::endl;
+        std::cout << "==================================================" << std::endl;
+        return;
+    }
+
+    try{
+
         this->session.reset( this->connection->createSession( cms::Session::AUTO_ACKNOWLEDGE ) );
         this->topic.reset( this->session->createTopic( this->getTopicName() ) );
         this->producer.reset( this->session->createProducer( this->topic.get() ) );