A MessageConsumer retrieves messages asynchronously when notified.

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

Featured

Most   Popular
Upcoming Events

AppTrends

Sign up for our newsletter.

Terms and Privacy Policy consent

I agree to this site's Privacy Policy.