A MessageConsumer retrieves messages asynchronously when notified.
- By Gopalan Suresh Raj
- July 17, 2000
Enterprise Java
Guarantee Inter-Enterprise Message Delivery Using JMS
Gopalan Suresh Raj
Listing 4. A MessageConsumer retrieves messages asynchronously when notified.
public void onMessage (Message msg) {
try {
// Retrieve the message
MapMessage mapMsg = (MapMessage)msg;
double sunPrice = mapMsg.getDouble("SUNW");
double msftPrice = mapMsg.getDouble("MSFT");
double cpwrPrice = mapMsg.getDouble("CPWR");
}
catch (JMSException e) {
e.printStackTrace ();
}
}