|
Websphere MQ Everyplace | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.ibm.mqe.jms.MQeMessageConsumer
A client uses a message consumer to receive messages from a Destination
.
A MessageConsumer
object is created by passing a
Destination
object to a message-consumer creation
method supplied by a session.
A message consumer can be created with a message selector. This allows the client to restrict the messages delivered to the message consumer to those that match the selector.
A client may either synchronously receive a message consumer's messages or have the consumer asynchronously deliver them as they arrive.
For synchronous receipt, a client can request the next message from a
message consumer using one of its receive
methods. There are
several variations of receive
that allow a
client to poll or wait for the next message.
For asynchronous delivery, a client can register a
MessageListener
object with a message consumer.
As messages arrive at the message consumer, it delivers them by calling the
MessageListener
's onMessage
method.
It is a client programming error for a MessageListener
to
throw an exception.
QueueReceiver
Constructor Summary | |
MQeMessageConsumer()
|
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()
Gets the message consumer's MessageListener . |
java.lang.String |
getMessageSelector()
Gets this message consumer's message selector expression. |
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 java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public MQeMessageConsumer()
Method Detail |
public java.lang.String getMessageSelector() throws javax.jms.JMSException
getMessageSelector
in interface javax.jms.MessageConsumer
javax.jms.JMSException
- if the JMS provider fails to get the message
selector due to some internal error.public javax.jms.MessageListener getMessageListener() throws javax.jms.JMSException
MessageListener
.
getMessageListener
in interface javax.jms.MessageConsumer
javax.jms.JMSException
- if the JMS provider fails to get the message
listener due to some internal error.MessageConsumer.setMessageListener(javax.jms.MessageListener)
public void setMessageListener(javax.jms.MessageListener newListener) throws javax.jms.JMSException
setMessageListener
in interface javax.jms.MessageConsumer
javax.jms.JMSException
- if JMS fails to set message
listener due to some JMS errorMessageConsumer.getMessageListener()
public javax.jms.Message receive() throws javax.jms.JMSException
receive
in interface javax.jms.MessageConsumer
javax.jms.JMSException
- if JMS fails to receive the next
message due to some error.public javax.jms.Message receive(long timeOut) throws javax.jms.JMSException
receive
in interface javax.jms.MessageConsumer
javax.jms.JMSException
- if JMS fails to receive the next
message due to some error.public javax.jms.Message receiveNoWait() throws javax.jms.JMSException
receiveNoWait
in interface javax.jms.MessageConsumer
javax.jms.JMSException
- if JMS fails to receive the next
message due to some error.public void close() throws javax.jms.JMSException
close
in interface javax.jms.MessageConsumer
javax.jms.JMSException
- if JMS fails to close the consumer
due to some error.
|
Websphere MQ Everyplace | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |