You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by spam trap <no...@spamgourmet.com> on 2012/08/29 14:35:12 UTC

Modifying consumed message (AcvtiveMQ-CPP)

I need to modify a consumed message (add new properties & change
payload) and then send it.  I know I can't do this directly as a
consumed message is read-only.  However I also find that a cloned copy
is also read-only.

How can I achieve this?


Re: Modifying consumed message (AcvtiveMQ-CPP)

Posted by Timothy Bish <ta...@gmail.com>.
On Fri, 2012-08-31 at 10:08 +0100, spam trap wrote: 
> On Thu, 30 Aug 2012 15:40:18 -0400, Timothy Bish
> <ta...@gmail.com> wrote:
> 
> >On Thu, 2012-08-30 at 12:44 +0100, spam trap wrote: 
> >> On Wed, 29 Aug 2012 10:08:36 -0400, Timothy Bish
> >> <ta...@gmail.com> wrote:
> >> 
> >> >On Wed, 2012-08-29 at 15:04 +0100, spam trap wrote: 
> >> >> On Wed, 29 Aug 2012 08:46:18 -0400, Timothy Bish
> >> >> <ta...@gmail.com> wrote:
> >> >> 
> >> >> >On Wed, 2012-08-29 at 13:35 +0100, spam trap wrote: 
> >> >> >> I need to modify a consumed message (add new properties & change
> >> >> >> payload) and then send it.  I know I can't do this directly as a
> >> >> >> consumed message is read-only.  However I also find that a cloned copy
> >> >> >> is also read-only.
> >> >> >> 
> >> >> >> How can I achieve this?
> >> >> >> 
> >> >> >
> >> >> >Sounds like a bug, you should open a Jira issue and attach a test case.
> >> >> >
> >> >> >You can reset the read-only flags manually by casting down to the
> >> >> >activemq::commands::Message type and calling the methods
> >> >> >setReadOnlyProperties and setReadOnlyBody.
> >> >> 
> >> >> I've tried this but it hasn't made any difference.  I know there could
> >> >> be something wrong with my code but it works if the Message object is
> >> >> newly created by not if it is cloned from a consumed message (received
> >> >> via an async consumer).
> >> >> 
> >> >
> >> >Best thing to do then is to create a new Jira issue and attach a unit
> >> >test. 
> >> 
> >> OK.  We'll do this.  For now we'll also need a workaround.  I can
> >> create a new message and copy over the body easily.  I am not sure how
> >> to determine the type of the properties so that these can be copied.
> >> 
> >> Any ideas, thanks?
> >> 
> >
> >This is fixed on trunk. also on trunk you can now query for property
> >types in the Message objects.  Not sure there is a workaround on the
> >v3.4.x code.  You might be able to cast down to the
> >activemq::commands::Message type and dig into the PrimitiveMap where the
> >properties are actually stored.  From my testing though calling
> >setReadOnlyProperties(false) works just fine.
> 
> Thanks.
> 
> Can you tell me when the changes will go into a official release? 
> 

The next stable release planned is v3.5.  I've been testing and
hardening the code in trunk as time permits, your help here would be
valuable.  If you'd like to check out the trunk code and give it a go in
your use case it could help find any lingering gremlins.  Once I feel
confident its in a good state I will start a release for v3.5

-- 
Tim Bish
Sr Software Engineer | FuseSource Corp
tim.bish@fusesource.com | www.fusesource.com
skype: tabish121 | twitter: @tabish121
blog: http://timbish.blogspot.com/


Re: Modifying consumed message (AcvtiveMQ-CPP)

Posted by spam trap <no...@spamgourmet.com>.
On Thu, 30 Aug 2012 15:40:18 -0400, Timothy Bish
<ta...@gmail.com> wrote:

>On Thu, 2012-08-30 at 12:44 +0100, spam trap wrote: 
>> On Wed, 29 Aug 2012 10:08:36 -0400, Timothy Bish
>> <ta...@gmail.com> wrote:
>> 
>> >On Wed, 2012-08-29 at 15:04 +0100, spam trap wrote: 
>> >> On Wed, 29 Aug 2012 08:46:18 -0400, Timothy Bish
>> >> <ta...@gmail.com> wrote:
>> >> 
>> >> >On Wed, 2012-08-29 at 13:35 +0100, spam trap wrote: 
>> >> >> I need to modify a consumed message (add new properties & change
>> >> >> payload) and then send it.  I know I can't do this directly as a
>> >> >> consumed message is read-only.  However I also find that a cloned copy
>> >> >> is also read-only.
>> >> >> 
>> >> >> How can I achieve this?
>> >> >> 
>> >> >
>> >> >Sounds like a bug, you should open a Jira issue and attach a test case.
>> >> >
>> >> >You can reset the read-only flags manually by casting down to the
>> >> >activemq::commands::Message type and calling the methods
>> >> >setReadOnlyProperties and setReadOnlyBody.
>> >> 
>> >> I've tried this but it hasn't made any difference.  I know there could
>> >> be something wrong with my code but it works if the Message object is
>> >> newly created by not if it is cloned from a consumed message (received
>> >> via an async consumer).
>> >> 
>> >
>> >Best thing to do then is to create a new Jira issue and attach a unit
>> >test. 
>> 
>> OK.  We'll do this.  For now we'll also need a workaround.  I can
>> create a new message and copy over the body easily.  I am not sure how
>> to determine the type of the properties so that these can be copied.
>> 
>> Any ideas, thanks?
>> 
>
>This is fixed on trunk. also on trunk you can now query for property
>types in the Message objects.  Not sure there is a workaround on the
>v3.4.x code.  You might be able to cast down to the
>activemq::commands::Message type and dig into the PrimitiveMap where the
>properties are actually stored.  From my testing though calling
>setReadOnlyProperties(false) works just fine.

Thanks.

Can you tell me when the changes will go into a official release? 


Re: Modifying consumed message (AcvtiveMQ-CPP)

Posted by Timothy Bish <ta...@gmail.com>.
On Thu, 2012-08-30 at 12:44 +0100, spam trap wrote: 
> On Wed, 29 Aug 2012 10:08:36 -0400, Timothy Bish
> <ta...@gmail.com> wrote:
> 
> >On Wed, 2012-08-29 at 15:04 +0100, spam trap wrote: 
> >> On Wed, 29 Aug 2012 08:46:18 -0400, Timothy Bish
> >> <ta...@gmail.com> wrote:
> >> 
> >> >On Wed, 2012-08-29 at 13:35 +0100, spam trap wrote: 
> >> >> I need to modify a consumed message (add new properties & change
> >> >> payload) and then send it.  I know I can't do this directly as a
> >> >> consumed message is read-only.  However I also find that a cloned copy
> >> >> is also read-only.
> >> >> 
> >> >> How can I achieve this?
> >> >> 
> >> >
> >> >Sounds like a bug, you should open a Jira issue and attach a test case.
> >> >
> >> >You can reset the read-only flags manually by casting down to the
> >> >activemq::commands::Message type and calling the methods
> >> >setReadOnlyProperties and setReadOnlyBody.
> >> 
> >> I've tried this but it hasn't made any difference.  I know there could
> >> be something wrong with my code but it works if the Message object is
> >> newly created by not if it is cloned from a consumed message (received
> >> via an async consumer).
> >> 
> >
> >Best thing to do then is to create a new Jira issue and attach a unit
> >test. 
> 
> OK.  We'll do this.  For now we'll also need a workaround.  I can
> create a new message and copy over the body easily.  I am not sure how
> to determine the type of the properties so that these can be copied.
> 
> Any ideas, thanks?
> 

This is fixed on trunk. also on trunk you can now query for property
types in the Message objects.  Not sure there is a workaround on the
v3.4.x code.  You might be able to cast down to the
activemq::commands::Message type and dig into the PrimitiveMap where the
properties are actually stored.  From my testing though calling
setReadOnlyProperties(false) works just fine.

-- 
Tim Bish
Sr Software Engineer | FuseSource Corp
tim.bish@fusesource.com | www.fusesource.com
skype: tabish121 | twitter: @tabish121
blog: http://timbish.blogspot.com/


Re: Modifying consumed message (AcvtiveMQ-CPP)

Posted by spam trap <no...@spamgourmet.com>.
On Wed, 29 Aug 2012 10:08:36 -0400, Timothy Bish
<ta...@gmail.com> wrote:

>On Wed, 2012-08-29 at 15:04 +0100, spam trap wrote: 
>> On Wed, 29 Aug 2012 08:46:18 -0400, Timothy Bish
>> <ta...@gmail.com> wrote:
>> 
>> >On Wed, 2012-08-29 at 13:35 +0100, spam trap wrote: 
>> >> I need to modify a consumed message (add new properties & change
>> >> payload) and then send it.  I know I can't do this directly as a
>> >> consumed message is read-only.  However I also find that a cloned copy
>> >> is also read-only.
>> >> 
>> >> How can I achieve this?
>> >> 
>> >
>> >Sounds like a bug, you should open a Jira issue and attach a test case.
>> >
>> >You can reset the read-only flags manually by casting down to the
>> >activemq::commands::Message type and calling the methods
>> >setReadOnlyProperties and setReadOnlyBody.
>> 
>> I've tried this but it hasn't made any difference.  I know there could
>> be something wrong with my code but it works if the Message object is
>> newly created by not if it is cloned from a consumed message (received
>> via an async consumer).
>> 
>
>Best thing to do then is to create a new Jira issue and attach a unit
>test. 

OK.  We'll do this.  For now we'll also need a workaround.  I can
create a new message and copy over the body easily.  I am not sure how
to determine the type of the properties so that these can be copied.

Any ideas, thanks?


Re: Modifying consumed message (AcvtiveMQ-CPP)

Posted by Timothy Bish <ta...@gmail.com>.
On Wed, 2012-08-29 at 15:04 +0100, spam trap wrote: 
> On Wed, 29 Aug 2012 08:46:18 -0400, Timothy Bish
> <ta...@gmail.com> wrote:
> 
> >On Wed, 2012-08-29 at 13:35 +0100, spam trap wrote: 
> >> I need to modify a consumed message (add new properties & change
> >> payload) and then send it.  I know I can't do this directly as a
> >> consumed message is read-only.  However I also find that a cloned copy
> >> is also read-only.
> >> 
> >> How can I achieve this?
> >> 
> >
> >Sounds like a bug, you should open a Jira issue and attach a test case.
> >
> >You can reset the read-only flags manually by casting down to the
> >activemq::commands::Message type and calling the methods
> >setReadOnlyProperties and setReadOnlyBody.
> 
> I've tried this but it hasn't made any difference.  I know there could
> be something wrong with my code but it works if the Message object is
> newly created by not if it is cloned from a consumed message (received
> via an async consumer).
> 

Best thing to do then is to create a new Jira issue and attach a unit
test. 

-- 
Tim Bish
Sr Software Engineer | FuseSource Corp
tim.bish@fusesource.com | www.fusesource.com
skype: tabish121 | twitter: @tabish121
blog: http://timbish.blogspot.com/


Re: Modifying consumed message (AcvtiveMQ-CPP)

Posted by spam trap <no...@spamgourmet.com>.
On Wed, 29 Aug 2012 08:46:18 -0400, Timothy Bish
<ta...@gmail.com> wrote:

>On Wed, 2012-08-29 at 13:35 +0100, spam trap wrote: 
>> I need to modify a consumed message (add new properties & change
>> payload) and then send it.  I know I can't do this directly as a
>> consumed message is read-only.  However I also find that a cloned copy
>> is also read-only.
>> 
>> How can I achieve this?
>> 
>
>Sounds like a bug, you should open a Jira issue and attach a test case.
>
>You can reset the read-only flags manually by casting down to the
>activemq::commands::Message type and calling the methods
>setReadOnlyProperties and setReadOnlyBody.

I've tried this but it hasn't made any difference.  I know there could
be something wrong with my code but it works if the Message object is
newly created by not if it is cloned from a consumed message (received
via an async consumer).


Re: Modifying consumed message (AcvtiveMQ-CPP)

Posted by Timothy Bish <ta...@gmail.com>.
On Wed, 2012-08-29 at 13:35 +0100, spam trap wrote: 
> I need to modify a consumed message (add new properties & change
> payload) and then send it.  I know I can't do this directly as a
> consumed message is read-only.  However I also find that a cloned copy
> is also read-only.
> 
> How can I achieve this?
> 

Sounds like a bug, you should open a Jira issue and attach a test case.

You can reset the read-only flags manually by casting down to the
activemq::commands::Message type and calling the methods
setReadOnlyProperties and setReadOnlyBody.

-- 
Tim Bish
Sr Software Engineer | FuseSource Corp
tim.bish@fusesource.com | www.fusesource.com
skype: tabish121 | twitter: @tabish121
blog: http://timbish.blogspot.com/