activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Clebert Suconic <>
Subject Re: How to put "properties" on a message so they are accessible later
Date Wed, 11 Oct 2017 00:18:38 GMT
We could add a new method call to the plugin... something like replaceMessage.

With that on hand you could then convert the AMQPMessage to a Core
Message using message.toCore().. and return the transformed message.

The message wouldn't be an AMQP message any longer from that point
on.. it would eventually be converted back to whatever other message
protocols it leads on the other side...  it would of course have some
performance impact but it would work.

On Tue, Oct 10, 2017 at 5:55 PM, Timothy Bish <> wrote:
> On 10/10/2017 05:20 PM, Harrison Tarr wrote:
>> Thanks for the quick reply. Is there any way to change something on the
>> message that my consumer could then access? Maybe not ApplicationProperties
>> but something else?
> Nothing that would be accessible via the JMS client API.
>> Harrison
>> -----Original Message-----
>> From: Timothy Bish []
>> Sent: Tuesday, October 10, 2017 2:11 PM
>> To:
>> Subject: Re: How to put "properties" on a message so they are accessible
>> later
>> On 10/10/2017 05:06 PM, Harrison Tarr wrote:
>>> Hello again,
>>> I wanted to follow up on this as I've done some more experimenting.
>>> I've found that when I use the Core protocol or Openwire protocol,
>>> everything works as expected. I am able to use the "setStringProperty"
>>> in my ActiveMQServerPlugin and it adds a header that I can then access
>>> in my Camel consumer code. However, if I try to add a property to a
>>> message that was sent using the AMQP protocol, it does not stay set on
>>> the message. It appears to me that this is because the AMQP message is
>>> more protected? Maybe it has all of the data in an immutable
>>> ByteBuffer? I've tried using the "reencode" method on the
>>> class,
>>> but it causes an error; it can't parse the message back out, it says
>>> something about an unknown constructor. (Being handled here
>>> n/java/org/apache/qpid/jms/provider/amqp/
>> AMQP ApplicationProperties are immutable so you cannot change or add to
>> them in flight, that would violate the AMQP specification.
>>> Justin, I've looked at the remoting interceptors. I think I decided
>>> against using them because it does not expose as much information to me as I
>>> wanted. I'm specifically trying to take the authentication credentials and
>>> then create some kind of authentication token to attach to the message that
>>> I can then use in my consuming code.
>>> Regards,
>>> Harrison Tarr
>>> -----Original Message-----
>>> From: Justin Bertram []
>>> Sent: Tuesday, September 12, 2017 3:28 PM
>>> To:
>>> Subject: Re: How to put "properties" on a message so they are
>>> accessible later
>>> I'm not terribly familiar with the ActiveMQServerPlugin functionality in
>>> this regard, but I do know that you can make such modifications to messages
>>> using remoting interceptors.  Have you explored that possibility?
>>> Justin
>>> On Tue, Sep 12, 2017 at 3:45 PM, Harrison Tarr
>>> <>
>>> wrote:
>>>> Right now I'm using Artemis 2.2.0.
>>>> I've done a bit more research and experimentation. It seems that I
>>>> can set a header in Camel, send the message to a queue/topic hosted
>>>> on Artemis and read the header as a "stringProperty". The header keys
>>>> also show up when I do a "getProperties" call. However, if I try to
>>>> overwrite that field in my ActiveMQServerPlugin (specifically the
>>>> beforeSend call), the change is not propagated to Camel. IE, if I send a
>>>> message with the header "testHeader"
>>>> with a value of "testValue", I can see, in Artemis, "testHeader" as a
>>>> property on the message with the value of "testValue". If I then try
>>>> to overwrite that value with "newValue", when I access the message
>>>> and its headers in the consumer, the header is still "testHeader"
>>>> with the value of "testValue", whereas I expect it to be "testHeader"
>>>> with a value of "newValue".
>>>> Harrison Tarr
>>>> -----Original Message-----
>>>> From: [] On Behalf Of Tim
>>>> Bain
>>>> Sent: Monday, September 11, 2017 6:26 PM
>>>> To: ActiveMQ Users <>
>>>> Subject: RE: How to put "properties" on a message so they are
>>>> accessible later
>>>> To be clear, you're asking about doing this in Artemis, not ActiveMQ
>>>> 5.x, right? What version of Artemis?
>>>> On Sep 11, 2017 2:48 PM, "Harrison Tarr" <>
>>>> wrote:
>>>>> I just wanted to follow up: Does anyone know how to put an
>>>>> attribute/property on a message in an ActiveMQServerPlugin that I
>>>>> can then pull out of the message in Camel?
>>>>> Regards,
>>>>> Harrison Tarr
>>>>> -----Original Message-----
>>>>> From: Harrison Tarr []
>>>>> Sent: Wednesday, September 6, 2017 8:56 AM
>>>>> To:
>>>>> Subject: How to put "properties" on a message so they are accessible
>>>>> later
>>>>> Hi,
>>>>> I'm trying to put a StringProperty on a Message in an
>>>>> ActiveMQServerPlugin. As far as I can tell, the property gets set
>>>>> correctly. Later, I'm trying to retrieve the property from a Camel
>>>>> Exchange. I don't see my property anywhere on the Exchange. I did
>>>>> notice that it looks like the properties "firedTime" and
>>>>> "breadcrumbId," which I think come from Artemis, do appear on the
>>>>> Camel Exchange, which makes me think there is some way to propagate
>>>>> my
>>>> property from Artemis to Camel.
>>>>> Regards,
>>>>> Harrison Tarr
>> --
>> Tim Bish
>> twitter: @tabish121
>> blog:
> --
> Tim Bish
> twitter: @tabish121
> blog:

Clebert Suconic

View raw message