activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r382041 - /incubator/activemq/trunk/cms/test/main.cpp
Date Wed, 01 Mar 2006 14:59:08 GMT
Author: jstrachan
Date: Wed Mar  1 06:59:03 2006
New Revision: 382041

URL: http://svn.apache.org/viewcvs?rev=382041&view=rev
Log:
added snippet example and Apache header

Modified:
    incubator/activemq/trunk/cms/test/main.cpp

Modified: incubator/activemq/trunk/cms/test/main.cpp
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/cms/test/main.cpp?rev=382041&r1=382040&r2=382041&view=diff
==============================================================================
--- incubator/activemq/trunk/cms/test/main.cpp (original)
+++ incubator/activemq/trunk/cms/test/main.cpp Wed Mar  1 06:59:03 2006
@@ -1,3 +1,20 @@
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+ 
 #include <activemq/ActiveMQTextMessage.h>
 #include <cms/TopicConnectionFactory.h>
 #include <cms/TopicConnection.h>
@@ -34,6 +51,7 @@
         	
         	printf("Starting activemqcms test (sending %d messages and sleeping %d seconds)
...\n", numMessages, sleepTime );
             
+            // START SNIPPET: demo
             cms::TopicConnectionFactory* connectionFactory = new activemq::ActiveMQConnectionFactory(
"127.0.0.1:61626" );
             cms::TopicConnection* connection = connectionFactory->createTopicConnection();
             connection->setExceptionListener( this );
@@ -49,13 +67,9 @@
                         
             for( int ix=0; ix<numMessages; ++ix ){                
                 publisher->publish( msg );
-                
-                
-                timespec sleepTime;
-                sleepTime.tv_sec = 0;
-                sleepTime.tv_nsec = 1000;
-                nanosleep( &sleepTime, &sleepTime );
+                doSleep();
             }
+            // END SNIPPET: demo
             
             sleep( sleepTime );
             
@@ -88,6 +102,13 @@
     
     virtual void onException( const cms::CMSException* error ){
         printf( "StompTester::onException() - %s\n", error->getMessage() );
+    }
+    
+    virtual void doSleep() {
+        timespec sleepTime;
+        sleepTime.tv_sec = 0;
+        sleepTime.tv_nsec = 1000;
+        nanosleep( &sleepTime, &sleepTime );
     }
     
 private:



Mime
View raw message