A MessageConsumer retrieves a TextMessage.

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

Featured

Most   Popular
Upcoming Events

AppTrends

Sign up for our newsletter.

Terms and Privacy Policy consent

I agree to this site's Privacy Policy.