You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by RobBugh <go...@mypacks.net> on 2007/08/20 20:49:56 UTC
How to Retrieve Message Properties
I'm having problems retrieving custom properties set on TextMessages. I have
a persistent queue to pass messages between a simple producer and consumer.
The producer sets several properties on a TextMessage such as,
TextMessage message = m_session.createTextMessage("EMSSyncRequest");
message.setStringProperty("JMSXGroupID", request.getGroupID());
message.setIntProperty("EType", request.getType());
message.setStringProperty("EFile", request.getMsg());
m_producer.send(message);
However, when the consumer gets the message the values for EType and EFile
are null. Trying to retrieve EType via getIntProperty throws an exception.
In the message object I see that the propery field in null but the
marshalledProperties field is not. I suspect the properties have been
marshalled. How do I go about unmarshalling the properties?
Rob
--
View this message in context: http://www.nabble.com/How-to-Retrieve-Message-Properties-tf4300804s2354.html#a12241730
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Re: How to Retrieve Message Properties
Posted by James Strachan <ja...@gmail.com>.
Could you provide a junit test case showing your issue?
On 8/20/07, RobBugh <go...@mypacks.net> wrote:
>
> I'm having problems retrieving custom properties set on TextMessages. I have
> a persistent queue to pass messages between a simple producer and consumer.
> The producer sets several properties on a TextMessage such as,
> TextMessage message = m_session.createTextMessage("EMSSyncRequest");
> message.setStringProperty("JMSXGroupID", request.getGroupID());
> message.setIntProperty("EType", request.getType());
> message.setStringProperty("EFile", request.getMsg());
> m_producer.send(message);
>
> However, when the consumer gets the message the values for EType and EFile
> are null. Trying to retrieve EType via getIntProperty throws an exception.
> In the message object I see that the propery field in null but the
> marshalledProperties field is not. I suspect the properties have been
> marshalled. How do I go about unmarshalling the properties?
>
> Rob
> --
> View this message in context:
> http://www.nabble.com/How-to-Retrieve-Message-Properties-tf4300804s2354.html#a12241730
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
>
--
James
-------
http://macstrac.blogspot.com/
Re: How to Retrieve Message Properties
Posted by ttmdev <jo...@ttmsolutions.com>.
I can set/get both String and Int properties on a TextMessage just fine. I am
using AMQ 4.1.1
Joe
RobBugh wrote:
>
> I can get around the problem if I use a MapMessage instead of a
> TextMessage. Is this correct behavior though? Shouldn't I still be able to
> set/get properties on a TextMessage?
>
>
> RobBugh wrote:
>>
>> I'm having problems retrieving custom properties set on TextMessages. I
>> have a persistent queue to pass messages between a simple producer and
>> consumer. The producer sets several properties on a TextMessage such as,
>> TextMessage message =
>> m_session.createTextMessage("EMSSyncRequest");
>> message.setStringProperty("JMSXGroupID", request.getGroupID());
>> message.setIntProperty("EType", request.getType());
>> message.setStringProperty("EFile", request.getMsg());
>> m_producer.send(message);
>>
>> However, when the consumer gets the message the values for EType and
>> EFile are null. Trying to retrieve EType via getIntProperty throws an
>> exception. In the message object I see that the propery field in null but
>> the marshalledProperties field is not. I suspect the properties have been
>> marshalled. How do I go about unmarshalling the properties?
>>
>> Rob
>>
>
>
--
View this message in context: http://www.nabble.com/How-to-Retrieve-Message-Properties-tf4300804s2354.html#a12242582
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Re: How to Retrieve Message Properties
Posted by RobBugh <go...@mypacks.net>.
I can get around the problem if I use a MapMessage instead of a TextMessage.
Is this correct behavior though? Shouldn't I still be able to set/get
properties on a TextMessage?
RobBugh wrote:
>
> I'm having problems retrieving custom properties set on TextMessages. I
> have a persistent queue to pass messages between a simple producer and
> consumer. The producer sets several properties on a TextMessage such as,
> TextMessage message =
> m_session.createTextMessage("EMSSyncRequest");
> message.setStringProperty("JMSXGroupID", request.getGroupID());
> message.setIntProperty("EType", request.getType());
> message.setStringProperty("EFile", request.getMsg());
> m_producer.send(message);
>
> However, when the consumer gets the message the values for EType and EFile
> are null. Trying to retrieve EType via getIntProperty throws an exception.
> In the message object I see that the propery field in null but the
> marshalledProperties field is not. I suspect the properties have been
> marshalled. How do I go about unmarshalling the properties?
>
> Rob
>
--
View this message in context: http://www.nabble.com/How-to-Retrieve-Message-Properties-tf4300804s2354.html#a12242017
Sent from the ActiveMQ - User mailing list archive at Nabble.com.