activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Albert Strasheim" <full...@gmail.com>
Subject Re: BytesMessage constness
Date Fri, 21 Sep 2007 19:38:15 GMT
Hello

Maybe MessageListener::onMessage should be fixed to pass a non-const Message 
instead of pretending that BytesMessage::read is const when it isn't (also 
consider something like std::istream::read, which isn't const).

In my experience mutable is typically used when you have a getter that is 
const but updates some kind of internal cache in the object. I think the 
BytesMessage::read situation is more like std::istream::read than it is like 
this case.

Cheers,

Albert

----- Original Message ----- 
From: "Motl" <motl@orcsoftware.com>
To: <users@activemq.apache.org>
Sent: Friday, September 21, 2007 1:45 PM
Subject: Re: BytesMessage constness


> Done.
>
> https://issues.apache.org/activemq/browse/AMQCPP-143
>
>
> nmittler wrote:
>>
>> I agree, this definitely would be a pain since the onMessage method gives
>> you a const Message.  Could you capture this issue in JIRA?
>> http://issues.apache.org/activemq/browse/AMQCPP
>>
>> Thanks,
>> Nate
>>
>>
>> On 9/21/07, Motl <motl@orcsoftware.com> wrote:
>>>
>>>
>>> Hi,
>>> I once asked you why readBytes() and other read methods aren't const:
>>>
>>> http://www.nabble.com/BytesMessage-methods-tf3833767s2354.html#a10853672
>>>
>>> But if only the stream pointer is updated, I suppose we could have
>>> another
>>> solution here, i.e.
>>> declare inputStream field as 'mutable':
>>>
>>> mutable io::ByteArrayInputStream inputStream;
>>>
>>> In that case we could keep read methods const.
>>>
>>> I am requesting for that because at the moment such non-const API forces
>>> app
>>> level either always deal with non-const objects or make
>>> const_cast<cms::BytesMessage *>(), that's not good.



Mime
View raw message