activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r1025774 - in /activemq/activemq-cpp/trunk/activemq-c/src/main/c: CMS_Message.cpp CMS_Message.h
Date Wed, 20 Oct 2010 21:54:04 GMT
Author: tabish
Date: Wed Oct 20 21:54:04 2010
New Revision: 1025774

URL: http://svn.apache.org/viewvc?rev=1025774&view=rev
Log:
Implement some more Message API wrappers.

Modified:
    activemq/activemq-cpp/trunk/activemq-c/src/main/c/CMS_Message.cpp
    activemq/activemq-cpp/trunk/activemq-c/src/main/c/CMS_Message.h

Modified: activemq/activemq-cpp/trunk/activemq-c/src/main/c/CMS_Message.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-c/src/main/c/CMS_Message.cpp?rev=1025774&r1=1025773&r2=1025774&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-c/src/main/c/CMS_Message.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-c/src/main/c/CMS_Message.cpp Wed Oct 20 21:54:04
2010
@@ -173,3 +173,75 @@ cms_status destroyMessage(CMS_Message* m
 
     return result;
 }
+
+////////////////////////////////////////////////////////////////////////////////
+cms_status cloneMessage(CMS_Message* original, CMS_Message** clone) {
+
+    cms_status result = CMS_SUCCESS;
+
+    if(original != NULL) {
+
+        std::auto_ptr<CMS_Message> wrapper( new CMS_Message );
+
+        try{
+            wrapper->message = original->message->clone();
+            wrapper->type = original->type;
+            *clone = wrapper.release();
+        } catch(...) {
+            result = CMS_ERROR;
+        }
+    }
+
+    return result;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+cms_status acknowledgeMessage(CMS_Message* message) {
+
+    cms_status result = CMS_SUCCESS;
+
+    if(message != NULL) {
+
+        try{
+            message->message->acknowledge();
+        } catch(...) {
+            result = CMS_ERROR;
+        }
+    }
+
+    return result;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+cms_status clearBody(CMS_Message* message) {
+
+    cms_status result = CMS_SUCCESS;
+
+    if(message != NULL) {
+
+        try{
+            message->message->clearBody();
+        } catch(...) {
+            result = CMS_ERROR;
+        }
+    }
+
+    return result;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+cms_status clearMessageProperties(CMS_Message* message) {
+
+    cms_status result = CMS_SUCCESS;
+
+    if(message != NULL) {
+
+        try{
+            message->message->clearProperties();
+        } catch(...) {
+            result = CMS_ERROR;
+        }
+    }
+
+    return result;
+}

Modified: activemq/activemq-cpp/trunk/activemq-c/src/main/c/CMS_Message.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-c/src/main/c/CMS_Message.h?rev=1025774&r1=1025773&r2=1025774&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-c/src/main/c/CMS_Message.h (original)
+++ activemq/activemq-cpp/trunk/activemq-c/src/main/c/CMS_Message.h Wed Oct 20 21:54:04 2010
@@ -105,6 +105,46 @@ cms_status createStreamMessage(CMS_Sessi
  */
 cms_status destroyMessage(CMS_Message* message);
 
+/**
+ * Creates a Copy of the given Message instance.
+ *
+ * @param original
+ *      The Message to clone.
+ * @param clone
+ *      The address of the location to store the new Message instance.
+ */
+cms_status cloneMessage(CMS_Message* original, CMS_Message** clone);
+
+/**
+ * Acknowledge the given Message.
+ *
+ * @param message
+ *      The Message to acknowledge.
+ */
+cms_status acknowledgeMessage(CMS_Message* message);
+
+/**
+ * Clears out the body of the message.  This does not clear the
+ * headers or properties.
+ *
+ * @param message
+ *      The Message whose body is to be cleared.
+ */
+cms_status clearBody(CMS_Message* message);
+
+/**
+ * Clears out the message body. Clearing a message's body does not clear
+ * its header values or property entries.
+ *
+ * If this message body was read-only, calling this method leaves the
+ * message body in the same state as an empty body in a newly created
+ * message.
+ *
+ * @param message
+ *      The Message whose properties are to be cleared.
+ */
+cms_status clearMessageProperties(CMS_Message* message);
+
 #ifdef __cplusplus
 }
 #endif



Mime
View raw message