Websphere MQ Everyplace

com.ibm.mqe.jms
Class MQeQueueReceiver

java.lang.Object
  |
  +--com.ibm.mqe.jms.MQeMessageConsumer
        |
        +--com.ibm.mqe.jms.MQeQueueReceiver
All Implemented Interfaces:
javax.jms.MessageConsumer, MQeMessageListenerInterface, javax.jms.QueueReceiver

public class MQeQueueReceiver
extends MQeMessageConsumer
implements javax.jms.QueueReceiver, MQeMessageListenerInterface

A client uses a QueueReceiver to receive messages that have been delivered to a queue.

See Also:
MessageConsumer

Constructor Summary
MQeQueueReceiver()
           
 
Method Summary
 void close()
          Since a provider may allocate some resources on behalf of a MessageConsumer outside the JVM, clients should close them when they are not needed.
 javax.jms.MessageListener getMessageListener()
          Get the message consumer's MessageListener.
 javax.jms.Queue getQueue()
          Get the queue associated with this queue receiver.
 javax.jms.Message receive()
          Receive the next message produced for this message consumer.
 javax.jms.Message receive(long timeOut)
          Receive the next message that arrives within the specified timeout interval.
 javax.jms.Message receiveNoWait()
          Receive the next message if one is immediately available.
 void setMessageListener(javax.jms.MessageListener newListener)
          Set the message consumer's MessageListener.
 
Methods inherited from class com.ibm.mqe.jms.MQeMessageConsumer
getMessageSelector
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.jms.MessageConsumer
getMessageSelector
 
Methods inherited from interface com.ibm.mqe.MQeMessageListenerInterface
messageArrived
 

Constructor Detail

MQeQueueReceiver

public MQeQueueReceiver()
Method Detail

getQueue

public javax.jms.Queue getQueue()
                         throws javax.jms.JMSException
Get the queue associated with this queue receiver.

Specified by:
getQueue in interface javax.jms.QueueReceiver
Returns:
the queue
Throws:
javax.jms.JMSException - if JMS fails to get queue for this queue receiver due to some internal error.

getMessageListener

public javax.jms.MessageListener getMessageListener()
                                             throws javax.jms.JMSException
Get the message consumer's MessageListener.

Specified by:
getMessageListener in interface javax.jms.MessageConsumer
Returns:
the listener for the message consumer, or null if this isn't one set.
Throws:
javax.jms.JMSException - if JMS fails to get message listener due to some JMS error
See Also:
MessageConsumer.setMessageListener(javax.jms.MessageListener)

setMessageListener

public void setMessageListener(javax.jms.MessageListener newListener)
                        throws javax.jms.JMSException
Set the message consumer's MessageListener.

Specified by:
setMessageListener in interface javax.jms.MessageConsumer
Throws:
javax.jms.JMSException - if JMS fails to set message listener due to some JMS error
See Also:
MessageConsumer.getMessageListener()

receive

public javax.jms.Message receive()
                          throws javax.jms.JMSException
Receive the next message produced for this message consumer. This call blocks indefinitely until a message is produced.

Specified by:
receive in interface javax.jms.MessageConsumer
Returns:
the next message produced for this message consumer.
Throws:
javax.jms.JMSException - if JMS fails to receive the next message due to some error.

receive

public javax.jms.Message receive(long timeOut)
                          throws javax.jms.JMSException
Receive the next message that arrives within the specified timeout interval. This call blocks until either a message arrives or the timeout expires.

Specified by:
receive in interface javax.jms.MessageConsumer
Returns:
the next message produced for this message consumer, or null if one is not available.
Throws:
javax.jms.JMSException - if JMS fails to receive the next message due to some error.

receiveNoWait

public javax.jms.Message receiveNoWait()
                                throws javax.jms.JMSException
Receive the next message if one is immediately available.

Specified by:
receiveNoWait in interface javax.jms.MessageConsumer
Returns:
the next message produced for this message consumer, or null if one is not available.
Throws:
javax.jms.JMSException - if JMS fails to receive the next message due to some error.

close

public void close()
           throws javax.jms.JMSException
Since a provider may allocate some resources on behalf of a MessageConsumer outside the JVM, clients should close them when they are not needed. Relying on garbage collection to eventually reclaim these resources may not be timely enough.

Specified by:
close in interface javax.jms.MessageConsumer
Overrides:
close in class MQeMessageConsumer
Throws:
javax.jms.JMSException - if JMS fails to close the consumer due to some error.

Websphere MQ Everyplace