activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r887936 - in /activemq/activemq-cpp/trunk/activemq-cpp/src/examples: consumers/SimpleAsyncConsumer.cpp producers/SimpleProducer.cpp
Date Mon, 07 Dec 2009 14:47:13 GMT
Author: tabish
Date: Mon Dec  7 14:47:12 2009
New Revision: 887936

URL: http://svn.apache.org/viewvc?rev=887936&view=rev
Log:
Cleaned up the sample code a bit.

Modified:
    activemq/activemq-cpp/trunk/activemq-cpp/src/examples/consumers/SimpleAsyncConsumer.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/examples/producers/SimpleProducer.cpp

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/examples/consumers/SimpleAsyncConsumer.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/examples/consumers/SimpleAsyncConsumer.cpp?rev=887936&r1=887935&r2=887936&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/examples/consumers/SimpleAsyncConsumer.cpp
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/examples/consumers/SimpleAsyncConsumer.cpp
Mon Dec  7 14:47:12 2009
@@ -66,10 +66,11 @@
                          const std::string& destURI,
                          bool useTopic = false,
                          bool clientAck = false ) {
-        connection = NULL;
-        session = NULL;
-        destination = NULL;
-        consumer = NULL;
+
+        this->connection = NULL;
+        this->session = NULL;
+        this->destination = NULL;
+        this->consumer = NULL;
         this->useTopic = useTopic;
         this->brokerURI = brokerURI;
         this->destURI = destURI;
@@ -160,7 +161,7 @@
     // registered as an ExceptionListener with the connection.
     virtual void onException( const CMSException& ex AMQCPP_UNUSED ) {
         printf("CMS Exception occurred.  Shutting down client.\n");
-        //exit(1);
+        exit(1);
     }
 
     virtual void transportInterrupted() {

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=887936&r1=887935&r2=887936&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 Mon
Dec  7 14:47:12 2009
@@ -64,12 +64,12 @@
                     unsigned int numMessages,
                     const std::string& destURI,
                     bool useTopic = false,
-                    bool clientAck = false,
-                    unsigned int connectRetries = 0 ){
-        connection = NULL;
-        session = NULL;
-        destination = NULL;
-        producer = NULL;
+                    bool clientAck = false ){
+
+        this->connection = NULL;
+        this->session = NULL;
+        this->destination = NULL;
+        this->producer = NULL;
         this->numMessages = numMessages;
         this->useTopic = useTopic;
         this->brokerURI = brokerURI;
@@ -87,6 +87,7 @@
 
     virtual void run() {
         try {
+
             // Create a ConnectionFactory
             auto_ptr<ActiveMQConnectionFactory> connectionFactory(
                 new ActiveMQConnectionFactory( brokerURI ) );
@@ -229,7 +230,11 @@
 
     // Create the producer and run it.
     SimpleProducer producer( brokerURI, numMessages, destURI, useTopics );
+
+    // Publish the given number of Messages
     producer.run();
+
+    // Before exiting we ensure that all CMS resources are closed.
     producer.close();
 
     std::cout << "-----------------------------------------------------\n";



Mime
View raw message