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 2010/03/08 14:52:40 UTC
svn commit: r920322 -
/activemq/activemq-cpp/trunk/activemq-cpp/src/examples/advisories/AdvisoryProducerMain.cpp
Author: tabish
Date: Mon Mar 8 13:52:40 2010
New Revision: 920322
URL: http://svn.apache.org/viewvc?rev=920322&view=rev
Log:
fix for: http://issues.apache.org/activemq/browse/AMQCPP-273
Modified:
activemq/activemq-cpp/trunk/activemq-cpp/src/examples/advisories/AdvisoryProducerMain.cpp
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/examples/advisories/AdvisoryProducerMain.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/examples/advisories/AdvisoryProducerMain.cpp?rev=920322&r1=920321&r2=920322&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/examples/advisories/AdvisoryProducerMain.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/examples/advisories/AdvisoryProducerMain.cpp Mon Mar 8 13:52:40 2010
@@ -52,39 +52,41 @@
//
std::string brokerURI = "failover:(tcp://127.0.0.1:61616)";
- // Create the Connection
- auto_ptr<cms::ConnectionFactory> connectionFactory(
- cms::ConnectionFactory::createCMSConnectionFactory( brokerURI ) );
-
- auto_ptr<cms::Connection> connection;
-
- // Create a Connection
- try{
- connection.reset( connectionFactory->createConnection() );
- } catch( CMSException& e ) {
- e.printStackTrace();
- return 1;
+ {
+ // Create the Connection
+ auto_ptr<cms::ConnectionFactory> connectionFactory(
+ cms::ConnectionFactory::createCMSConnectionFactory( brokerURI ) );
+
+ auto_ptr<cms::Connection> connection;
+
+ // Create a Connection
+ try{
+ connection.reset( connectionFactory->createConnection() );
+ } catch( CMSException& e ) {
+ e.printStackTrace();
+ return 1;
+ }
+
+ // Create the Session
+ std::auto_ptr<cms::Session> session( connection->createSession() );
+
+ // Create the producer and run it.
+ AdvisoryProducer advisoryProducer( session.get() );
+ Thread runner( &advisoryProducer );
+ runner.start();
+
+ // Start the Connection now.
+ connection->start();
+
+ // Wait until we are told to quit.
+ std::cout << "Press 'q' to quit" << std::endl;
+ while( std::cin.get() != 'q') {}
+
+ // Shutdown now
+ advisoryProducer.stop();
+ connection->stop();
}
- // Create the Session
- std::auto_ptr<cms::Session> session( connection->createSession() );
-
- // Create the producer and run it.
- AdvisoryProducer advisoryProducer( session.get() );
- Thread runner( &advisoryProducer );
- runner.start();
-
- // Start the Connection now.
- connection->start();
-
- // Wait until we are told to quit.
- std::cout << "Press 'q' to quit" << std::endl;
- while( std::cin.get() != 'q') {}
-
- // Shutdown now
- advisoryProducer.stop();
- connection->stop();
-
std::cout << "-----------------------------------------------------\n";
std::cout << "Finished with the example." << std::endl;
std::cout << "=====================================================\n";