activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r1026015 - in /activemq/activemq-cpp/trunk/activemq-c/src/main/c: CMS_MessageConsumer.cpp CMS_MessageConsumer.h
Date Thu, 21 Oct 2010 14:42:35 GMT
Author: tabish
Date: Thu Oct 21 14:42:34 2010
New Revision: 1026015

URL: http://svn.apache.org/viewvc?rev=1026015&view=rev
Log:
Completes the C API for all cms::MessageConsumer methods

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

Modified: activemq/activemq-cpp/trunk/activemq-c/src/main/c/CMS_MessageConsumer.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-c/src/main/c/CMS_MessageConsumer.cpp?rev=1026015&r1=1026014&r2=1026015&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-c/src/main/c/CMS_MessageConsumer.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-c/src/main/c/CMS_MessageConsumer.cpp Thu Oct 21 14:42:34
2010
@@ -218,6 +218,37 @@ cms_status closeConsumer(CMS_MessageCons
 }
 
 ////////////////////////////////////////////////////////////////////////////////
+cms_status getConsumerMessageSelector(CMS_MessageConsumer* consumer, char* dest, int size)
{
+
+    cms_status result = CMS_SUCCESS;
+
+    if(consumer != NULL && dest != NULL && size > 0) {
+
+        try{
+
+            std::string selector = consumer->consumer->getMessageSelector();
+
+            if(!selector.empty()) {
+
+                std::size_t pos = 0;
+                for(; pos < selector.size() && pos < size - 1; ++pos) {
+                    dest[pos] = selector.at(pos);
+                }
+
+                dest[pos] = '\0';
+            } else {
+                dest[0] = '\0';
+            }
+
+        } catch(...) {
+            result = CMS_ERROR;
+        }
+    }
+
+    return result;
+}
+
+////////////////////////////////////////////////////////////////////////////////
 cms_status destroyConsumer(CMS_MessageConsumer* consumer) {
 
     cms_status result = CMS_SUCCESS;

Modified: activemq/activemq-cpp/trunk/activemq-c/src/main/c/CMS_MessageConsumer.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-c/src/main/c/CMS_MessageConsumer.h?rev=1026015&r1=1026014&r2=1026015&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-c/src/main/c/CMS_MessageConsumer.h (original)
+++ activemq/activemq-cpp/trunk/activemq-c/src/main/c/CMS_MessageConsumer.h Thu Oct 21 14:42:34
2010
@@ -142,6 +142,23 @@ cms_status consumerReceiveNoWait(CMS_Mes
 cms_status closeConsumer(CMS_MessageConsumer* consumer);
 
 /**
+ * Gets the Message Selector that is assigned to the given MessageConsumer if there is one.
+ * The method will copy the Selector into the provided char array.  The copied string is
+ * always null terminate so if the selector is larger than the provided size the number
+ * of chars copied will be size - 1.
+ *
+ * @param consumer
+ *      The Consumer whose selector string is to be retrieved.
+ * @param dest
+ *      The character array to copy the selector string to.
+ * @param size
+ *      The size of the provided character array.
+ *
+ * @return result code indicating the success or failure of the operation.
+ */
+cms_status getConsumerMessageSelector(CMS_MessageConsumer* consumer, char* dest, int size);
+
+/**
  * Destroys the given Consumer instance.
  *
  * @param consumer



Mime
View raw message