Author: tabish
Date: Mon Mar 8 13:55:12 2010
New Revision: 920323
URL: http://svn.apache.org/viewvc?rev=920323&view=rev
Log:
fix for: http://issues.apache.org/activemq/browse/AMQCPP-273
Modified:
activemq/activemq-cpp/branches/activemq-cpp-3.1.x/activemq-cpp/src/examples/advisories/AdvisoryProducerMain.cpp
Modified:
activemq/activemq-cpp/branches/activemq-cpp-3.1.x/activemq-cpp/src/examples/advisories/AdvisoryProducerMain.cpp
URL:
http://svn.apache.org/viewvc/activemq/activemq-cpp/branches/activemq-cpp-3.1.x/activemq-cpp/src/examples/advisories/AdvisoryProducerMain.cpp?rev=920323&r1=920322&r2=920323&view=diff
==============================================================================
---
activemq/activemq-cpp/branches/activemq-cpp-3.1.x/activemq-cpp/src/examples/advisories/AdvisoryProducerMain.cpp
(original)
+++
activemq/activemq-cpp/branches/activemq-cpp-3.1.x/activemq-cpp/src/examples/advisories/AdvisoryProducerMain.cpp
Mon Mar 8 13:55:12 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";