|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ConsumerEndpoint
represents the server-side view of of the
MessageConsumer
and QueueBrowser
interfaces
Method Summary | |
boolean |
canConsume(JmsDestination destination)
Determines if this consumer can consume messages from the specified destination. |
void |
close()
Close and release any resource allocated to this endpoint. |
JmsDestination |
getDestination()
Return the destination that this consumer is accessing. |
long |
getId()
Returns the identity of this consumer. |
int |
getMessageCount()
Returns the number of unsent messages in the cache. |
boolean |
getNoLocal()
Returns if locally produced messages are being inhibited. |
java.lang.String |
getPersistentId()
Returns the persistent identifier for this consumer. |
Selector |
getSelector()
Returns the message selector. |
boolean |
isAsynchronous()
Determines if this is an asynchronous consumer. |
boolean |
isClosed()
Determines if this consumer is closed, or in the process of being closed. |
boolean |
isPersistent()
Determines if this is a persistent or non-persistent consumer. |
boolean |
isWaitingForMessage()
Determines if the client is currently waiting for a message. |
boolean |
messageAdded(MessageHandle handle,
MessageImpl message)
This event is called when a non-persistent message is added to a DestinationCache . |
void |
messageRemoved(java.lang.String messageId)
This event is called when a message is removed from the DestinationCache . |
boolean |
persistentMessageAdded(MessageHandle handle,
MessageImpl message)
This event is called when a persistent message is added to the DestinationCache . |
void |
persistentMessageRemoved(java.lang.String messageId)
This event is called when a message is removed from the DestinationCache . |
MessageHandle |
receive(Condition cancel)
Return the next available message to the client. |
boolean |
selects(MessageImpl message)
Determines if a message is selected by the consumer. |
void |
setAsynchronous(boolean asynchronous)
Indicates if this is an asynchronous consumer. |
void |
setListener(ConsumerEndpointListener listener)
Set the listener for this consumer. |
void |
setWaitingForMessage(Condition condition)
Indicates that the client is currently waiting for a message. |
Method Detail |
public long getId()
public boolean isPersistent()
getPersistentId()
returns a non-null valuetrue
if this is a persistent consumer; otherwise
false
public java.lang.String getPersistentId()
null
if this is a transient consumerpublic JmsDestination getDestination()
public boolean canConsume(JmsDestination destination)
destination
- the destinationtrue
if the consumer can consume messages from
destination
; otherwise false
public Selector getSelector()
null
if none was specified
by the clientpublic boolean selects(MessageImpl message)
message
- the message to checktrue
if the message is selected; otherwise
false
public boolean getNoLocal()
true
if locally published messages are being
inhibited.public MessageHandle receive(Condition cancel) throws javax.jms.JMSException
cancel
- if set, indictates to cancel the receivenull
if none is availablejavax.jms.JMSException
- for any errorpublic void setAsynchronous(boolean asynchronous)
MessageConsumer
with
an associated MessageListener
.asynchronous
- if true
marks this as an asynchronous
consumerpublic boolean isAsynchronous()
true
if this is an asynchronous consumer; otherwise
false
public void setWaitingForMessage(Condition condition)
condition
- the condition to evaluate to determine if the client is
waiting for message. May be null
.public boolean isWaitingForMessage()
true
if the client is waiting for messages;
otherwise false
public void setListener(ConsumerEndpointListener listener)
listener
- the listener to add, or null
to remove an
existing listenerpublic int getMessageCount()
public boolean isClosed()
true
if this consumer is closed; otherwise
false
public void close()
public boolean messageAdded(MessageHandle handle, MessageImpl message) throws javax.jms.JMSException
DestinationCache
.handle
- a handle to the added messagemessage
- the added messagetrue
if the listener accepted the message; otherwise
false- Throws:
javax.jms.JMSException
- if the listener fails to handle the message
public void messageRemoved(java.lang.String messageId) throws javax.jms.JMSException
DestinationCache
.messageId
- the identifier of the removed messagejavax.jms.JMSException
- if the listener fails to handle the messagepublic boolean persistentMessageAdded(MessageHandle handle, MessageImpl message) throws javax.jms.JMSException, PersistenceException
DestinationCache
.handle
- a handle to the added messagemessage
- the added messagetrue
if the listener accepted the message;javax.jms.JMSException
- if the listener fails to handle the messagePersistenceException
- if there is a persistence related problempublic void persistentMessageRemoved(java.lang.String messageId) throws javax.jms.JMSException, PersistenceException
DestinationCache
.messageId
- the identifier of the removed messagejavax.jms.JMSException
- if the listener fails to handle the messagePersistenceException
- if there is a persistence related problem
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |