You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Nawaz Ahmed <na...@progress.com> on 2009/02/04 05:29:56 UTC

How to Set the header value to the JMS messages

Hello Friends,

 

These are the headers of the JMS Message:

 

JMSDestination, JMSRedelivered, JMSTimestamp, JMSExpiration, JMSType,
JMSDeliveryMode, JMSMessageID=, JMSXGroupID, JMSCorrelationID,
JMSPriority, JMSReplyTo

 

I want to know is there any way to add header to the JMS Messages?

            

Had used the method setHeader(String name, String value) but
unfortunately it doesnt work.  

 

What is the other way to set the header along with the value and also to
retrieve the same?

 

 

Thanks and Regards,

Nawaz Ahmed

 


Re: How to Set the header value to the JMS messages

Posted by gui pei <gu...@gmail.com>.
Hi, Nawaz

JMS specialization use following method to implement it, and it has other
type method for other data type.

*getStringProperty*(String<http://java.sun.com/j2se/1.4/docs/api/java/lang/String.html>
 name)
          Returns the value of the String property with the specified name.

*setStringProperty*(String<http://java.sun.com/j2se/1.4/docs/api/java/lang/String.html>
 name, String <http://java.sun.com/j2se/1.4/docs/api/java/lang/String.html>
 value)
          Sets a String property value with the specified name into the
message.


If you use message property here, you can filter message at consumer side.





On Wed, Feb 4, 2009 at 12:29 PM, Nawaz Ahmed <na...@progress.com> wrote:

> Hello Friends,
>
>
>
> These are the headers of the JMS Message:
>
>
>
> JMSDestination, JMSRedelivered, JMSTimestamp, JMSExpiration, JMSType,
> JMSDeliveryMode, JMSMessageID=, JMSXGroupID, JMSCorrelationID,
> JMSPriority, JMSReplyTo
>
>
>
> I want to know is there any way to add header to the JMS Messages?
>
>
>
> Had used the method setHeader(String name, String value) but
> unfortunately it doesnt work.
>
>
>
> What is the other way to set the header along with the value and also to
> retrieve the same?
>
>
>
>
>
> Thanks and Regards,
>
> Nawaz Ahmed
>
>
>
>


-- 
It's winter now, let's hibernate.

Re: How to Set the header value to the JMS messages

Posted by Gary Tully <ga...@gmail.com>.
Hi Nawaz,
A great place to look for example JMS usage is the activemq test
suite. For example, the SelectorTest shows how message properties can
be set and consumed based on property values: see:
http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsTopicSelectorTest.java?view=markup
There is also a Queue based variant that extends this test.

Note that priority message consumption is currently not supported in
activemq. see: http://activemq.apache.org/how-can-i-support-priority-queues.html

2009/2/4 Nawaz Ahmed <na...@progress.com>:
> Hello Friends,
>
>
>
> These are the headers of the JMS Message:
>
>
>
> JMSDestination, JMSRedelivered, JMSTimestamp, JMSExpiration, JMSType,
> JMSDeliveryMode, JMSMessageID=, JMSXGroupID, JMSCorrelationID,
> JMSPriority, JMSReplyTo
>
>
>
> I want to know is there any way to add header to the JMS Messages?
>
>
>
> Had used the method setHeader(String name, String value) but
> unfortunately it doesnt work.
>
>
>
> What is the other way to set the header along with the value and also to
> retrieve the same?
>
>
>
>
>
> Thanks and Regards,
>
> Nawaz Ahmed
>
>
>
>



-- 
http://blog.garytully.com

Open Source SOA
http://FUSESource.com