Return-Path: Delivered-To: apmail-activemq-users-archive@www.apache.org Received: (qmail 75986 invoked from network); 19 Feb 2009 19:24:56 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 19 Feb 2009 19:24:56 -0000 Received: (qmail 20951 invoked by uid 500); 19 Feb 2009 19:24:55 -0000 Delivered-To: apmail-activemq-users-archive@activemq.apache.org Received: (qmail 20926 invoked by uid 500); 19 Feb 2009 19:24:55 -0000 Mailing-List: contact users-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@activemq.apache.org Delivered-To: mailing list users@activemq.apache.org Received: (qmail 20915 invoked by uid 99); 19 Feb 2009 19:24:55 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 19 Feb 2009 11:24:55 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of tabish121@gmail.com designates 74.125.92.145 as permitted sender) Received: from [74.125.92.145] (HELO qw-out-1920.google.com) (74.125.92.145) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 19 Feb 2009 19:24:45 +0000 Received: by qw-out-1920.google.com with SMTP id 9so165013qwj.26 for ; Thu, 19 Feb 2009 11:24:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:subject:from:to:in-reply-to :references:content-type:date:message-id:mime-version:x-mailer :content-transfer-encoding; bh=9VmaqYesJaYbj4+1zL8/k7viWVOID8uGE/yLYT9ddT0=; b=lCPZinSwsuA+SePAi3xV5V5hhHp9F45igPwg27Tl2t+JKdJ2GhCaI37poOCDOQnBdF 5vXrfEN3UA/qGy2yvSc6yGef9CM1TydnU4VShk9iBdYsPT/YeIbyEcfv2ptMmJfgCRK8 HqljCPldddhnU6fJYvBRLRLpj7hRWaIyG8ab0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=subject:from:to:in-reply-to:references:content-type:date:message-id :mime-version:x-mailer:content-transfer-encoding; b=wWLld1iQ38vhbcDKQGBdgmsQaaJh8v/nHtya2InQMlc/NvuRyv+ljuwltHgy83RCyn z9qkVI2xIWLekNmYgIXCquJnlLA1wYZcppcLY9cEzo9FgGMjPB5MHVH/z0p48HRL6tHZ gXu1hvz4q8KqaS7kBDqdI5pFJwG60oYEfft10= Received: by 10.224.36.202 with SMTP id u10mr9874832qad.123.1235071464240; Thu, 19 Feb 2009 11:24:24 -0800 (PST) Received: from ?192.168.2.199? ([68.49.143.174]) by mx.google.com with ESMTPS id 7sm2182152qwf.50.2009.02.19.11.24.23 (version=SSLv3 cipher=RC4-MD5); Thu, 19 Feb 2009 11:24:23 -0800 (PST) Subject: Re: problems reading a cms::BytesMessage. From: Timothy Bish To: users@activemq.apache.org In-Reply-To: References: Content-Type: text/plain Date: Thu, 19 Feb 2009 14:24:21 -0500 Message-Id: <1235071462.3688.3.camel@office> Mime-Version: 1.0 X-Mailer: Evolution 2.22.3.1 (2.22.3.1-1.fc9) Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org On Thu, 2009-02-19 at 19:06 +0100, Eduardo Montoya wrote: > Hello, > > I have some problems when reading a cms::BytesMessage. > > first of all, my client code looks like: > > void MyMessageListener::onMessage( const Message* message ) > { > const BytesMessage* b = dynamic_cast( message ); > if (b != NULL) > { > std::size_t len = b->getBodyLength(); // this line compiles and works. > > int i = b->readInt(); // this compiles but gives me an exception. Its possible that there's either no data in the message or we have a bug in setting the message into readonly mode correctly. > // message is in write-only mode .... > > // then i tried to execute the following line to set the input stream to read-only > b->reset(); // this line does not compile. You can't do this with async since the message is const here, you don't own the message that's contained in the onMessage callback, if you wanted to reset the message you'd need to call Message::clone to get a new instance of it that's yours to alter or store for later use. This might be a workaround if for you if we do in fact have a bug in the code. > > // VC++ 2008 express edition compiler says: > // error C2662: 'cms::BytesMessage::reset' : cannot convert 'this' pointer from 'const > // cms::BytesMessage' to 'cms::BytesMessage &' > > } > } > > i found the following issue: > > https://issues.apache.org/activemq/browse/AMQCPP-143 > > but it talks only about readXXX methods. > not about reset method. > > could anyone give me any advice to resolve this problem? > > thank a lot for all your replies. > If you can create a sample test case to reproduce this problem and attach it to a new Jira issue we can look into what is going on and hopefully get it fixed in the next release. > Kind Regards, > > Eduardo > Regards Tim. -- Tim Bish http://fusesource.com http://timbish.blogspot.com/