|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.huihoo.jfox.ms.jms.base.MessageConsumerImpl
This class implements the JMS message producer. A client uses a MessageConsumer object 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.
| Constructor Summary | |
MessageConsumerImpl(SessionImpl session,
java.lang.String messageSelector)
|
|
| Method Summary | |
void |
close()
Closes the message consumer. |
javax.jms.MessageListener |
getMessageListener()
Gets the message consumer's MessageListener. |
java.lang.String |
getMessageSelector()
Gets this message consumer's message selector expression. |
boolean |
isClosed()
Indicates the status of this message consumer. |
javax.jms.Message |
receive()
Receives the next message produced for this message consumer. |
javax.jms.Message |
receive(long timeout)
Receives the next message that arrives within the specified timeout interval. |
javax.jms.Message |
receiveNoWait()
Receives the next message if one is immediately available.Do not wait for a message to be recevied. |
void |
setMessageListener(javax.jms.MessageListener listener)
ets 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 MessageConsumerImpl(SessionImpl session,
java.lang.String messageSelector)
| Method Detail |
public javax.jms.MessageListener getMessageListener()
throws javax.jms.JMSException
MessageListener.
getMessageListener in interface javax.jms.MessageConsumerjavax.jms.JMSException
public void setMessageListener(javax.jms.MessageListener listener)
throws javax.jms.JMSException
Setting the message listener to null is the equivalent of unsetting the message listener for the message consumer.
The effect of calling MessageConsumer.setMessageListener while messages are being consumed by an existing listener or the consumer is being used to consume messages synchronously is undefined.
setMessageListener in interface javax.jms.MessageConsumerlistener - the listener to which the messages are to be delivered
javax.jms.JMSException
public java.lang.String getMessageSelector()
throws javax.jms.JMSException
getMessageSelector in interface javax.jms.MessageConsumerjavax.jms.JMSException
public javax.jms.Message receive()
throws javax.jms.JMSException
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.
receive in interface javax.jms.MessageConsumerjavax.jms.JMSException
public javax.jms.Message receive(long timeout)
throws javax.jms.JMSException
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.
receive in interface javax.jms.MessageConsumertimeout - the timeout value (in milliseconds)
javax.jms.JMSException
public javax.jms.Message receiveNoWait()
throws javax.jms.JMSException
receiveNoWait in interface javax.jms.MessageConsumerjavax.jms.JMSException
public void close()
throws javax.jms.JMSException
Since a provider may allocate some resources on behalf of a MessageConsumer outside the Java virtual machine, clients should close them when they are not needed. Relying on garbage collection to eventually reclaim these resources may not be timely enough.
This call blocks until a receive or message listener in progress has completed. A blocked message consumer receive call
close in interface javax.jms.MessageConsumerjavax.jms.JMSExceptionpublic boolean isClosed()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||