O'Reilly logo

Sams Teach Yourself J2EE™ in 21 Days by Peter Roxburgh, Andy Longshaw, Debbie Law, Dan Haywood, Martin Bond

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Simple Synchronous Receiver Example

The code for a simple synchronous receiver is very similar to that of the sender method already presented. There are two differences in constructing the QueueReceiver object.

The first one is obvious; a QueueReceiver is created instead of a QueueSender. Like createSender(), the createReceiver() method throws a JMSException if the session fails to create a receiver, and an InvalidDestinationException if an invalid queue is specified.

The second difference is that this time there is a call to the connection's start() method, which starts (or restarts) delivery of incoming messages for this receiver. Calling start() twice has no detrimental effect. It also has no effect on the connection's ability to send messages. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required