Return-Path: Delivered-To: apmail-activemq-commits-archive@www.apache.org Received: (qmail 9793 invoked from network); 21 Oct 2010 14:43:34 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 21 Oct 2010 14:43:34 -0000 Received: (qmail 35613 invoked by uid 500); 21 Oct 2010 14:43:34 -0000 Delivered-To: apmail-activemq-commits-archive@activemq.apache.org Received: (qmail 34774 invoked by uid 500); 21 Oct 2010 14:43:32 -0000 Mailing-List: contact commits-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list commits@activemq.apache.org Received: (qmail 34767 invoked by uid 99); 21 Oct 2010 14:43:31 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 21 Oct 2010 14:43:31 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 21 Oct 2010 14:43:31 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 534512388980; Thu, 21 Oct 2010 14:42:35 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@activemq.apache.org From: tabish@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20101021144235.534512388980@eris.apache.org> 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