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. ...
Get Sams Teach Yourself J2EE™ in 21 Days now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.