receive

 

public Message receive(long timeout) throws JMSException;

Receives the next message that arrives within the specified timeout interval.

This call blocks until a message arrives, the timeout expires, or this message consumer is closed. A timeout of zero never expires, and the call blocks indefinitely.

Parameters

  • timeout - the timeout value (milliseconds)

Returns

  • the next message produced for this message consumer, or null if the timeout expires, or this message consumer is concurrently closed

Exceptions

  • JMSException - if the JMS provider fails to receive the next message due to an internal error.


uj29370_