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 2009/07/22 20:51:35 UTC
svn commit: r796830 -
/activemq/activemq-cpp/trunk/activemq-cpp/src/examples/producers/SimpleProducer.cpp
Author: tabish
Date: Wed Jul 22 18:51:35 2009
New Revision: 796830
URL: http://svn.apache.org/viewvc?rev=796830&view=rev
Log:
Remove the Connection retries logic as this is all taken care of by the Failover Transport now.
Modified:
activemq/activemq-cpp/trunk/activemq-cpp/src/examples/producers/SimpleProducer.cpp
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/examples/producers/SimpleProducer.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/examples/producers/SimpleProducer.cpp?rev=796830&r1=796829&r2=796830&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/examples/producers/SimpleProducer.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/examples/producers/SimpleProducer.cpp Wed Jul 22 18:51:35 2009
@@ -56,7 +56,6 @@
unsigned int numMessages;
std::string brokerURI;
std::string destURI;
- unsigned int connectRetries;
public:
@@ -75,41 +74,26 @@
this->brokerURI = brokerURI;
this->destURI = destURI;
this->clientAck = clientAck;
- this->connectRetries = 0;
}
virtual ~SimpleProducer(){
cleanup();
}
- void setConnectRetries( unsigned int retries ) {
- this->connectRetries = retries;
- }
-
- unsigned int getConnectRetries() const {
- return this->connectRetries;
- }
-
virtual void run() {
try {
// Create a ConnectionFactory
auto_ptr<ActiveMQConnectionFactory> connectionFactory(
new ActiveMQConnectionFactory( brokerURI ) );
- unsigned int retries = this->connectRetries;
- do{
- // Create a Connection
- try{
- connection = connectionFactory->createConnection();
- connection->start();
- } catch( CMSException& e ) {
- e.printStackTrace();
-
- if( retries == 0 ) {
- return;
- }
- }
- } while( retries-- != 0 );
+ // Create a Connection
+ try{
+ connection = connectionFactory->createConnection();
+ connection->start();
+ } catch( CMSException& e ) {
+ e.printStackTrace();
+ throw e;
+ }
// Create a Session
if( clientAck ) {
@@ -238,20 +222,8 @@
//============================================================
bool useTopics = false;
- // Pass an integer value to the producer for retry
- unsigned int connectRetries = 0;
-
- if( argc > 1 ) {
- try {
- connectRetries = decaf::lang::Integer::parseInt( argv[1] );
- } catch( decaf::lang::exceptions::NumberFormatException& ex ) {
- connectRetries = 0;
- }
- }
-
// Create the producer and run it.
SimpleProducer producer( brokerURI, numMessages, destURI, useTopics );
- producer.setConnectRetries( connectRetries );
producer.run();
std::cout << "-----------------------------------------------------\n";