A MessageConsumer retrieves a TextMessage.
- By Gopalan Suresh Raj
- July 17, 2000
Enterprise Java
Guarantee Inter-Enterprise Message Delivery Using JMS
Gopalan Suresh Raj
Listing 5. A MessageConsumer retrieves a TextMessage.
public void onMessage (Message msg) {
try {
// When a message is received, print it out to
// standard output
TextMessage textmsg = (TextMessage)msg;
System.out.println("Received : " + textmsg.getText() );
} catch (JMSException e) {
e.printStackTrace ();
}
}