ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ Java / JMS » onMessage() & read message props

Post new topic  Reply to topic
 onMessage() & read message props « View previous topic :: View next topic » 
Author Message
vanessa
PostPosted: Fri Feb 08, 2002 12:29 am    Post subject: Reply with quote

Novice

Joined: 24 Jan 2002
Posts: 22

I am having problems in reading the message properties in onMessage()
i put the template here, i want to know how to get - set properties for a message.(i inlcuded them in comments) ... just give me a simple one

thanks

---------------------------------------------------------------------------


public void onMessage(javax.jms.Message message) {

try {

// how to get the message properties
// how to set the message properties

}
catch(){}

---------------------------------------------------------------------------
Back to top
View user's profile Send private message
kolban
PostPosted: Fri Feb 08, 2002 7:18 am    Post subject: Reply with quote

Grand Master

Joined: 22 May 2001
Posts: 1072
Location: Fort Worth, TX, USA

Firstly, it is not meaningful to set the message properties in an onMessage invocation. For the most part, the message is readonly.

What do you mean by the message properties? If you mean the payload of the message, I suspect that you want to cast the message to one of the JMS message types (e.g. TextMessage) and then use the readXXX methods to extract the contents field by field.
Back to top
View user's profile Send private message
abmanesh
PostPosted: Fri Feb 08, 2002 1:01 pm    Post subject: Reply with quote

Apprentice

Joined: 06 Nov 2001
Posts: 39


'Am not quite clear what is the exact problem you are having. Any way here is a method body implementing the onMessage method . The method displays the message text if the message if of text message.
*/
public void onMessage(Message message){
try {
if (message instanceof TextMessage){
System.out.println(((TextMessage)message).getText());
}
}catch (JMSException e){
e.printStackTrace();
}
}
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » onMessage() & read message props
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.