MQMessageConsumer

public class MQMessageConsumer
extends Object
implements MessageConsumer
java.lang.Object
   |
   +----com.ibm.mq.jms.MQMessageConsumer
          

MQMessageConsumer is the parent interface for all message consumers. A client uses a message consumer to receive messages from a Destination .

Methods

close

public void close() throws JMSException;

Closes the message consumer. Because a provider can allocate some resources outside the Java Virtual Machine on behalf of a MessageConsumer , clients must close them when they are not needed. You cannot rely on garbage collection to reclaim these resources eventually because this might not occur soon enough. This call blocks until a receive() or active message listener has completed.

Exceptions

getDestination

public Destination getDestination() throws JMSException;

Gets the message destination.

Returns
Exceptions

getMessageListener

public MessageListener getMessageListener() throws JMSException;

Gets the message consumer's MessageListener.

Returns
Exceptions

getMessageSelector

public String getMessageSelector() throws JMSException;

Gets this message consumer's message selector expression.

Returns
Exceptions

getNoLocal

public boolean getNoLocal() throws JMSException;

Indicates whether locally published messages are inhibited.

Returns
Exceptions

receive

public Message receive() throws JMSException;

Receives the next message produced for this message consumer.

This call blocks indefinitely until a message is produced or until this message consumer is closed.

If this receive() is done within a transaction, the consumer retains the message until the transaction commits.

Returns
Exceptions

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
Returns
Exceptions

receiveNoWait

public Message receiveNoWait() throws JMSException;

Receives the next message if one is immediately available.

Returns
Exceptions

setMessageListener

public void setMessageListener(MessageListener listener) 
              throws JMSException;

Sets the message consumer's MessageListener.

Parameters
Exceptions