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 2012/10/14 00:52:42 UTC

svn commit: r1397966 - in /activemq/activemq-cpp/trunk/activemq-cpp/src: main/activemq/cmsutil/ main/activemq/core/ main/activemq/core/kernels/ main/cms/ test/activemq/cmsutil/

Author: tabish
Date: Sat Oct 13 22:52:41 2012
New Revision: 1397966

URL: http://svn.apache.org/viewvc?rev=1397966&view=rev
Log:
work for: https://issues.apache.org/jira/browse/AMQCPP-435

Add the producer send methods with an AsyncCallback to the CMS API and implement the methods in the producer classes.

Modified:
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/cmsutil/CachedProducer.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQProducer.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQProducer.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/kernels/ActiveMQProducerKernel.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/kernels/ActiveMQProducerKernel.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/cms/MessageProducer.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/cmsutil/DummyProducer.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/cmsutil/MessageContext.h

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/cmsutil/CachedProducer.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/cmsutil/CachedProducer.h?rev=1397966&r1=1397965&r2=1397966&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/cmsutil/CachedProducer.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/cmsutil/CachedProducer.h Sat Oct 13 22:52:41 2012
@@ -27,22 +27,24 @@ namespace cmsutil {
     /**
      * A cached message producer contained within a pooled session.
      */
-    class AMQCPP_API CachedProducer : public cms::MessageProducer {
+    class AMQCPP_API CachedProducer: public cms::MessageProducer {
     private:
 
         cms::MessageProducer* producer;
 
     private:
 
-        CachedProducer( const CachedProducer& );
-        CachedProducer& operator= ( const CachedProducer& );
+        CachedProducer(const CachedProducer&);
+        CachedProducer& operator=(const CachedProducer&);
 
     public:
 
-        CachedProducer( cms::MessageProducer* producer ) : producer( producer ) {
+        CachedProducer(cms::MessageProducer* producer) :
+                producer(producer) {
         }
 
-        virtual ~CachedProducer() {}
+        virtual ~CachedProducer() {
+        }
 
         /**
          * Does nothing - the real producer resource will be closed
@@ -52,64 +54,72 @@ namespace cmsutil {
             // Do nothing.
         }
 
-        virtual void send( cms::Message* message ) {
-            producer->send( message );
+        virtual void send(cms::Message* message) {
+            producer->send(message);
         }
 
-        virtual void send( cms::Message* message, int deliveryMode,
-                           int priority, long long timeToLive ) {
+        virtual void send(cms::Message* message, cms::AsyncCallback* onComplete) {
+            producer->send(message, onComplete);
+        }
 
-            producer->send( message, deliveryMode, priority, timeToLive );
+        virtual void send(cms::Message* message, int deliveryMode, int priority, long long timeToLive) {
+            producer->send(message, deliveryMode, priority, timeToLive);
         }
 
+        virtual void send(cms::Message* message, int deliveryMode, int priority, long long timeToLive, cms::AsyncCallback* onComplete) {
+            producer->send(message, deliveryMode, priority, timeToLive, onComplete);
+        }
 
-        virtual void send( const cms::Destination* destination,
-                           cms::Message* message ) {
+        virtual void send(const cms::Destination* destination, cms::Message* message) {
+            producer->send(destination, message);
+        }
 
-            producer->send( destination, message );
+        virtual void send(const cms::Destination* destination, cms::Message* message, cms::AsyncCallback* onComplete) {
+            producer->send(destination, message, onComplete);
         }
 
-        virtual void send( const cms::Destination* destination,
-                           cms::Message* message, int deliveryMode,
-                           int priority, long long timeToLive ) {
+        virtual void send(const cms::Destination* destination, cms::Message* message, int deliveryMode, int priority, long long timeToLive) {
+            producer->send(destination, message, deliveryMode, priority, timeToLive);
+        }
 
-            producer->send( destination, message, deliveryMode, priority, timeToLive );
+        virtual void send(const cms::Destination* destination, cms::Message* message, int deliveryMode, int priority, long long timeToLive, cms::AsyncCallback* onComplete) {
+            producer->send(destination, message, deliveryMode, priority, timeToLive, onComplete);
         }
 
-        virtual void setDeliveryMode( int mode ) {
-            producer->setDeliveryMode( mode );
+        virtual void setDeliveryMode(int mode) {
+            producer->setDeliveryMode(mode);
         }
 
         virtual int getDeliveryMode() const {
             return producer->getDeliveryMode();
         }
 
-        virtual void setDisableMessageID( bool value ) {
-            producer->setDisableMessageID( value );
+        virtual void setDisableMessageID(bool value) {
+            producer->setDisableMessageID(value);
         }
 
         virtual bool getDisableMessageID() const {
             return producer->getDisableMessageID();
         }
 
-        virtual void setDisableMessageTimeStamp( bool value ) {
-            producer->setDisableMessageTimeStamp( value );
+        virtual void setDisableMessageTimeStamp(bool value) {
+            producer->setDisableMessageTimeStamp(value);
         }
 
         virtual bool getDisableMessageTimeStamp() const {
             return producer->getDisableMessageTimeStamp();
         }
 
-        virtual void setPriority( int priority ) {
-            producer->setPriority( priority );
+        virtual void setPriority(int priority) {
+            producer->setPriority(priority);
         }
 
         virtual int getPriority() const {
             return producer->getPriority();
         }
 
-        virtual void setTimeToLive( long long time ) {
-            producer->setTimeToLive( time );
+        virtual void setTimeToLive(long long time) {
+            producer->setTimeToLive(time);
         }
 
         virtual long long getTimeToLive() const {

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQProducer.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQProducer.cpp?rev=1397966&r1=1397965&r2=1397966&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQProducer.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQProducer.cpp Sat Oct 13 22:52:41 2012
@@ -66,6 +66,15 @@ void ActiveMQProducer::send(cms::Message
 }
 
 ////////////////////////////////////////////////////////////////////////////////
+void ActiveMQProducer::send(cms::Message* message, cms::AsyncCallback* callback) {
+
+    try {
+        this->kernel->send(message, callback);
+    }
+    AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
+}
+
+////////////////////////////////////////////////////////////////////////////////
 void ActiveMQProducer::send(cms::Message* message, int deliveryMode, int priority, long long timeToLive) {
 
     try {
@@ -75,6 +84,15 @@ void ActiveMQProducer::send(cms::Message
 }
 
 ////////////////////////////////////////////////////////////////////////////////
+void ActiveMQProducer::send(cms::Message* message, int deliveryMode, int priority, long long timeToLive, cms::AsyncCallback* callback) {
+
+    try {
+        this->kernel->send(message, deliveryMode, priority, timeToLive, callback);
+    }
+    AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
+}
+
+////////////////////////////////////////////////////////////////////////////////
 void ActiveMQProducer::send(const cms::Destination* destination, cms::Message* message) {
 
     try {
@@ -84,6 +102,15 @@ void ActiveMQProducer::send(const cms::D
 }
 
 ////////////////////////////////////////////////////////////////////////////////
+void ActiveMQProducer::send(const cms::Destination* destination, cms::Message* message, cms::AsyncCallback* callback) {
+
+    try {
+        this->kernel->send(destination, message, callback);
+    }
+    AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
+}
+
+////////////////////////////////////////////////////////////////////////////////
 void ActiveMQProducer::send(const cms::Destination* destination, cms::Message* message,
                             int deliveryMode, int priority, long long timeToLive) {
 
@@ -92,3 +119,13 @@ void ActiveMQProducer::send(const cms::D
     }
     AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
 }
+
+////////////////////////////////////////////////////////////////////////////////
+void ActiveMQProducer::send(const cms::Destination* destination, cms::Message* message,
+                            int deliveryMode, int priority, long long timeToLive, cms::AsyncCallback* callback) {
+
+    try {
+        this->kernel->send(destination, message, deliveryMode, priority, timeToLive, callback);
+    }
+    AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
+}

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQProducer.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQProducer.h?rev=1397966&r1=1397965&r2=1397966&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQProducer.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQProducer.h Sat Oct 13 22:52:41 2012
@@ -62,13 +62,22 @@ namespace core{
 
         virtual void send(cms::Message* message);
 
+        virtual void send(cms::Message* message, cms::AsyncCallback* callback);
+
         virtual void send(cms::Message* message, int deliveryMode, int priority, long long timeToLive);
 
+        virtual void send(cms::Message* message, int deliveryMode, int priority, long long timeToLive, cms::AsyncCallback* callback);
+
         virtual void send(const cms::Destination* destination, cms::Message* message);
 
+        virtual void send(const cms::Destination* destination, cms::Message* message, cms::AsyncCallback* callback);
+
         virtual void send(const cms::Destination* destination, cms::Message* message,
                           int deliveryMode, int priority, long long timeToLive);
 
+        virtual void send(const cms::Destination* destination, cms::Message* message,
+                          int deliveryMode, int priority, long long timeToLive, cms::AsyncCallback* callback);
+
         /**
          * Sets the delivery mode for this Producer
          * @param mode - The DeliveryMode to use for Message sends.

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/kernels/ActiveMQProducerKernel.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/kernels/ActiveMQProducerKernel.cpp?rev=1397966&r1=1397965&r2=1397966&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/kernels/ActiveMQProducerKernel.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/kernels/ActiveMQProducerKernel.cpp Sat Oct 13 22:52:41 2012
@@ -135,7 +135,17 @@ void ActiveMQProducerKernel::send(cms::M
 
     try {
         this->checkClosed();
-        this->send(this->destination.get(), message);
+        this->send(this->destination.get(), message, defaultDeliveryMode, defaultPriority, defaultTimeToLive, NULL);
+    }
+    AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ActiveMQProducerKernel::send(cms::Message* message, cms::AsyncCallback* callback) {
+
+    try {
+        this->checkClosed();
+        this->send(this->destination.get(), message, defaultDeliveryMode, defaultPriority, defaultTimeToLive, callback);
     }
     AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
 }
@@ -145,7 +155,17 @@ void ActiveMQProducerKernel::send(cms::M
 
     try {
         this->checkClosed();
-        this->send(this->destination.get(), message, deliveryMode, priority, timeToLive);
+        this->send(this->destination.get(), message, deliveryMode, priority, timeToLive, NULL);
+    }
+    AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ActiveMQProducerKernel::send(cms::Message* message, int deliveryMode, int priority, long long timeToLive, cms::AsyncCallback* callback) {
+
+    try {
+        this->checkClosed();
+        this->send(this->destination.get(), message, deliveryMode, priority, timeToLive, callback);
     }
     AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
 }
@@ -155,7 +175,17 @@ void ActiveMQProducerKernel::send(const 
 
     try {
         this->checkClosed();
-        this->send(destination, message, defaultDeliveryMode, defaultPriority, defaultTimeToLive);
+        this->send(destination, message, defaultDeliveryMode, defaultPriority, defaultTimeToLive, NULL);
+    }
+    AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ActiveMQProducerKernel::send(const cms::Destination* destination, cms::Message* message, cms::AsyncCallback* callback) {
+
+    try {
+        this->checkClosed();
+        this->send(destination, message, defaultDeliveryMode, defaultPriority, defaultTimeToLive, callback);
     }
     AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
 }
@@ -165,6 +195,17 @@ void ActiveMQProducerKernel::send(const 
                                   int deliveryMode, int priority, long long timeToLive) {
 
     try {
+        this->checkClosed();
+        this->send(destination, message, deliveryMode, priority, timeToLive, NULL);
+    }
+    AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ActiveMQProducerKernel::send(const cms::Destination* destination, cms::Message* message,
+                                  int deliveryMode, int priority, long long timeToLive, cms::AsyncCallback* callback) {
+
+    try {
 
         this->checkClosed();
 

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/kernels/ActiveMQProducerKernel.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/kernels/ActiveMQProducerKernel.h?rev=1397966&r1=1397965&r2=1397966&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/kernels/ActiveMQProducerKernel.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/kernels/ActiveMQProducerKernel.h Sat Oct 13 22:52:41 2012
@@ -118,13 +118,22 @@ namespace kernels {
 
         virtual void send(cms::Message* message);
 
+        virtual void send(cms::Message* message, cms::AsyncCallback* callback);
+
         virtual void send(cms::Message* message, int deliveryMode, int priority, long long timeToLive);
 
+        virtual void send(cms::Message* message, int deliveryMode, int priority, long long timeToLive, cms::AsyncCallback* callback);
+
         virtual void send(const cms::Destination* destination, cms::Message* message);
 
+        virtual void send(const cms::Destination* destination, cms::Message* message, cms::AsyncCallback* callback);
+
         virtual void send(const cms::Destination* destination, cms::Message* message,
                           int deliveryMode, int priority, long long timeToLive);
 
+        virtual void send(const cms::Destination* destination, cms::Message* message,
+                          int deliveryMode, int priority, long long timeToLive, cms::AsyncCallback* callback);
+
         /**
          * Set an MessageTransformer instance that is applied to all cms::Message objects before they
          * are sent on to the CMS bus.

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/cms/MessageProducer.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/cms/MessageProducer.h?rev=1397966&r1=1397965&r2=1397966&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/cms/MessageProducer.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/cms/MessageProducer.h Sat Oct 13 22:52:41 2012
@@ -19,6 +19,7 @@
 #define _CMS_MESSAGEPRODUCER_H_
 
 #include <cms/Config.h>
+#include <cms/AsyncCallback.h>
 #include <cms/Message.h>
 #include <cms/Destination.h>
 #include <cms/Closeable.h>
@@ -62,9 +63,9 @@ namespace cms{
         virtual ~MessageProducer();
 
         /**
-         * Sends the message to the default producer destination, but does
-         * not take ownership of the message, caller must still destroy it.
-         * Uses default values for deliveryMode, priority, and time to live.
+         * Sends the message to the default producer destination, but does not take ownership
+         * of the message, caller must still destroy it.  Uses default values for deliveryMode,
+         * priority, and time to live.
          *
          * @param message
          *      The message to be sent.
@@ -79,6 +80,29 @@ namespace cms{
         virtual void send(Message* message) = 0;
 
         /**
+         * Sends the message to the default producer destination, but does not take ownership
+         * of the message, caller must still destroy it.  Uses default values for deliveryMode,
+         * priority, and time to live.  If the AsyncCallback parameter is set this method will
+         * return immediately and the call-back will be notified once the CMS Provider as
+         * acknowledge receipt of the Message or an Error occurs.
+         *
+         * @param message
+         *      The message to be sent.
+         * @param onComplete
+         *      The AsyncCallback instance to notify on send complete or error, caller
+         *      retains ownership of this pointer and must destroy it only after the
+         *      send completes or the connection is closed.
+         *
+         * @throws CMSException - if an internal error occurs while sending the message.
+         * @throws MessageFormatException - if an Invalid Message is given.
+         * @throws InvalidDestinationException - if a client uses this method with a
+         *         MessageProducer with an invalid destination.
+         * @throws UnsupportedOperationException - if a client uses this method with a
+         *         MessageProducer that did not specify a destination at creation time.
+         */
+        virtual void send(Message* message, AsyncCallback* onComplete) = 0;
+
+        /**
          * Sends the message to the default producer destination, but does
          * not take ownership of the message, caller must still destroy it.
          *
@@ -101,6 +125,35 @@ namespace cms{
         virtual void send(Message* message, int deliveryMode, int priority, long long timeToLive) = 0;
 
         /**
+         * Sends the message to the default producer destination, but does not take ownership
+         * of the message, caller must still destroy it.  If the AsyncCallback parameter is set
+         * this method will return immediately and the call-back will be notified once the CMS
+         * Provider as acknowledge receipt of the Message or an Error occurs.
+         *
+         * @param message
+         *      The message to be sent.
+         * @param deliveryMode
+         *      The delivery mode to be used.
+         * @param priority
+         *      The priority for this message.
+         * @param timeToLive
+         *      The time to live value for this message in milliseconds.
+         * @param onComplete
+         *      The AsyncCallback instance to notify on send complete or error, caller
+         *      retains ownership of this pointer and must destroy it only after the
+         *      send completes or the connection is closed.
+         *
+         * @throws CMSException - if an internal error occurs while sending the message.
+         * @throws MessageFormatException - if an Invalid Message is given.
+         * @throws InvalidDestinationException - if a client uses this method with a
+         *         MessageProducer with an invalid destination.
+         * @throws UnsupportedOperationException - if a client uses this method with a
+         *         MessageProducer that did not specify a destination at creation time.
+         */
+        virtual void send(Message* message, int deliveryMode, int priority,
+                          long long timeToLive, AsyncCallback* onComplete) = 0;
+
+        /**
          * Sends the message to the designated destination, but does
          * not take ownership of the message, caller must still destroy it.
          * Uses default values for deliveryMode, priority, and time to live.
@@ -120,8 +173,33 @@ namespace cms{
         virtual void send(const Destination* destination, Message* message) = 0;
 
         /**
-         * Sends the message to the designated destination, but does
-         * not take ownership of the message, caller must still destroy it.
+         * Sends the message to the designated destination, but does not take ownership of the
+         * message, caller must still destroy it.  Uses default values for deliveryMode, priority,
+         * and time to live.  If the AsyncCallback parameter is set this method will return
+         * immediately and the call-back will be notified once the CMS Provider as acknowledge
+         * receipt of the Message or an Error occurs.
+         *
+         * @param destination
+         *      The destination on which to send the message
+         * @param message
+         *      the message to be sent.
+         * @param onComplete
+         *      The AsyncCallback instance to notify on send complete or error, caller
+         *      retains ownership of this pointer and must destroy it only after the
+         *      send completes or the connection is closed.
+         *
+         * @throws CMSException - if an internal error occurs while sending the message.
+         * @throws MessageFormatException - if an Invalid Message is given.
+         * @throws InvalidDestinationException - if a client uses this method with a
+         *         MessageProducer with an invalid destination.
+         * @throws UnsupportedOperationException - if a client uses this method with a
+         *         MessageProducer that did not specify a destination at creation time.
+         */
+        virtual void send(const Destination* destination, Message* message, AsyncCallback* onComplete) = 0;
+
+        /**
+         * Sends the message to the designated destination, but does not take ownership
+         * of the message, caller must still destroy it.
          *
          * @param destination
          *      The destination on which to send the message
@@ -145,6 +223,37 @@ namespace cms{
                           int deliveryMode, int priority, long long timeToLive) = 0;
 
         /**
+         * Sends the message to the designated destination, but does not take ownership
+         * of the message, caller must still destroy it.  If the AsyncCallback parameter
+         * is set this method will return immediately and the call-back will be notified
+         * once the CMS Provider as acknowledge receipt of the Message or an Error occurs.
+         *
+         * @param destination
+         *      The destination on which to send the message
+         * @param message
+         *      The message to be sent.
+         * @param deliveryMode
+         *      The delivery mode to be used.
+         * @param priority
+         *      The priority for this message.
+         * @param timeToLive
+         *      The time to live value for this message in milliseconds.
+         * @param onComplete
+         *      The AsyncCallback instance to notify on send complete or error, caller
+         *      retains ownership of this pointer and must destroy it only after the
+         *      send completes or the connection is closed.
+         *
+         * @throws CMSException - if an internal error occurs while sending the message.
+         * @throws MessageFormatException - if an Invalid Message is given.
+         * @throws InvalidDestinationException - if a client uses this method with a
+         *         MessageProducer with an invalid destination.
+         * @throws UnsupportedOperationException - if a client uses this method with a
+         *         MessageProducer that did not specify a destination at creation time.
+         */
+        virtual void send(const Destination* destination, Message* message, int deliveryMode,
+                          int priority, long long timeToLive, AsyncCallback* onComplete) = 0;
+
+        /**
          * Sets the delivery mode for this Producer
          *
          * @param mode

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/cmsutil/DummyProducer.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/cmsutil/DummyProducer.h?rev=1397966&r1=1397965&r2=1397966&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/cmsutil/DummyProducer.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/cmsutil/DummyProducer.h Sat Oct 13 22:52:41 2012
@@ -54,72 +54,35 @@ namespace cmsutil {
         virtual void close() {
         }
 
-        /**
-         * Sends the message to the default producer destination, but does
-         * not take ownership of the message, caller must still destroy it.
-         * Uses default values for deliveryMode, priority, and time to live.
-         *
-         * @param message
-         *      The message to be sent.
-         * @throws cms::CMSException
-         */
-        virtual void send(cms::Message* message) throw (cms::CMSException) {
+        virtual void send(cms::Message* message) {
             send(message, deliveryMode, priority, ttl);
         }
 
-        /**
-         * Sends the message to the default producer destination, but does
-         * not take ownership of the message, caller must still destroy it.
-         *
-         * @param message
-         *      The message to be sent.
-         * @param deliveryMode
-         *      The delivery mode to be used.
-         * @param priority
-         *      The priority for this message.
-         * @param timeToLive
-         *      The time to live value for this message in milliseconds.
-         * @throws cms::CMSException
-         */
-        virtual void send(cms::Message* message, int deliveryMode, int priority, long long timeToLive) throw (cms::CMSException) {
+        virtual void send(cms::Message* message, cms::AsyncCallback* onComplate) {
+            send(message, deliveryMode, priority, ttl, onComplate);
+        }
 
+        virtual void send(cms::Message* message, int deliveryMode, int priority, long long timeToLive) {
             send(dest, message, deliveryMode, priority, timeToLive);
         }
 
-        /**
-         * Sends the message to the designated destination, but does
-         * not take ownership of the message, caller must still destroy it.
-         * Uses default values for deliveryMode, priority, and time to live.
-         *
-         * @param destination
-         *      The destination on which to send the message
-         * @param message
-         *      the message to be sent.
-         * @throws cms::CMSException
-         */
-        virtual void send(const cms::Destination* destination, cms::Message* message) throw (cms::CMSException) {
+        virtual void send(cms::Message* message, int deliveryMode, int priority, long long timeToLive, cms::AsyncCallback* onComplete) {
+            send(dest, message, deliveryMode, priority, timeToLive, onComplete);
+        }
+
+        virtual void send(const cms::Destination* destination, cms::Message* message) {
             send(dest, message, deliveryMode, priority, ttl);
         }
 
-        /**
-         * Sends the message to the designated destination, but does
-         * not take ownership of the message, caller must still destroy it.
-         *
-         * @param destination
-         *      The destination on which to send the message
-         * @param message
-         *      The message to be sent.
-         * @param deliveryMode
-         *      The delivery mode to be used.
-         * @param priority
-         *      The priority for this message.
-         * @param timeToLive
-         *      The time to live value for this message in milliseconds.
-         * @throws cms::CMSException
-         */
-        virtual void send(const cms::Destination* destination, cms::Message* message, int deliveryMode, int priority, long long timeToLive)
-            throw (cms::CMSException) {
+        virtual void send(const cms::Destination* destination, cms::Message* message, cms::AsyncCallback* onComplete) {
+            send(dest, message, deliveryMode, priority, ttl, onComplete);
+        }
+
+        virtual void send(const cms::Destination* destination, cms::Message* message, int deliveryMode, int priority, long long timeToLive) {
+            messageContext->send(destination, message, deliveryMode, priority, timeToLive);
+        }
 
+        virtual void send(const cms::Destination* destination, cms::Message* message, int deliveryMode, int priority, long long timeToLive, cms::AsyncCallback* onComplete) {
             messageContext->send(destination, message, deliveryMode, priority, timeToLive);
         }
 

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/cmsutil/MessageContext.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/cmsutil/MessageContext.h?rev=1397966&r1=1397965&r2=1397966&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/cmsutil/MessageContext.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/cmsutil/MessageContext.h Sat Oct 13 22:52:41 2012
@@ -15,8 +15,8 @@
  * limitations under the License.
  */
 
-#ifndef ACTIVEMQ_CMSUTIL_MESSAGECONTEXT_H_
-#define ACTIVEMQ_CMSUTIL_MESSAGECONTEXT_H_
+#ifndef _ACTIVEMQ_CMSUTIL_MESSAGECONTEXT_H_
+#define _ACTIVEMQ_CMSUTIL_MESSAGECONTEXT_H_
 
 #include <cms/Destination.h>
 #include <cms/Message.h>
@@ -25,60 +25,58 @@ namespace activemq {
 namespace cmsutil {
 
     class MessageContext {
-        
+
     public:
-            
+
         class SendListener {
         public:
-            
+
             virtual ~SendListener(){}
-            
+
             virtual void onSend(const cms::Destination* destination,
-                cms::Message* message, int deliveryMode, int priority, 
-                long long timeToLive) throw (cms::CMSException)= 0;
-            
-            virtual cms::Message* doReceive(const cms::Destination* dest, 
-                    const std::string& selector, 
-                    bool noLocal, 
-                    long long timeout) throw (cms::CMSException) = 0;
+                cms::Message* message, int deliveryMode, int priority,
+                long long timeToLive) = 0;
+
+            virtual cms::Message* doReceive(const cms::Destination* dest,
+                                            const std::string& selector,
+                                            bool noLocal,
+                                            long long timeout) = 0;
         };
-        
+
     private:
-        
+
         SendListener* listener;
-        
+
     public:
-        
+
         MessageContext() {
             listener = NULL;
         }
+
         virtual ~MessageContext(){}
-            
+
         void setSendListener(SendListener* listener) {
             this->listener = listener;
         }
-        
+
         void send(const cms::Destination* destination,
-            cms::Message* message, int deliveryMode, int priority, 
-            long long timeToLive) throw (cms::CMSException){
-            
+                  cms::Message* message, int deliveryMode, int priority, long long timeToLive) {
+
             if( listener != NULL ) {
                 listener->onSend(destination, message, deliveryMode, priority, timeToLive);
             }
         }
-        
-        cms::Message* receive(const cms::Destination* dest, 
-                const std::string& selector, 
-                bool noLocal, 
-                long long timeout) throw (cms::CMSException){
-            
-            if( listener != NULL ) {
+
+        cms::Message* receive(const cms::Destination* dest, const std::string& selector,
+                              bool noLocal,  long long timeout) {
+
+            if (listener != NULL) {
                 return listener->doReceive(dest, selector, noLocal, timeout);
             }
-            
+
             return NULL;
         }
     };
 }}
 
-#endif /*ACTIVEMQ_CMSUTIL_MESSAGECONTEXT_H_*/
+#endif /*_ACTIVEMQ_CMSUTIL_MESSAGECONTEXT_H_*/