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
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.
'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();
}
}
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