|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--org.exolab.jms.messagemgr.AbstractConsumerEndpoint
Abstract implementation of the ConsumerEndpoint interface.
| Constructor Summary | |
AbstractConsumerEndpoint(long consumerId,
JmsDestination destination,
java.lang.String selector,
boolean noLocal)
Construct a new ConsumerEndpoint. |
|
| Method Summary | |
boolean |
canConsume(JmsDestination destination)
Determines if this consumer can consume messages from the specified destination. |
void |
close()
Close this endpoint. |
protected abstract void |
doClose()
Closes the endpoint. |
protected abstract MessageHandle |
doReceive(Condition cancel)
Return the next available message to the client. |
JmsDestination |
getDestination()
Return the destination that this consumer is accessing. |
long |
getId()
Returns the identity of this consumer. |
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. |
protected void |
notifyMessageAvailable()
Notify the listener that a message is available for this consumer. |
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. |
protected void |
setNoLocal(boolean noLocal)
Determines if locally produced messages are being inhibited. |
protected void |
setSelector(java.lang.String selector)
Sets the message selector. |
void |
setWaitingForMessage(Condition condition)
Indicates that the client is currently waiting for a message. |
java.lang.String |
toString()
Returns a stringified version of the consumer. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.exolab.jms.messagemgr.ConsumerEndpoint |
getMessageCount, messageAdded, messageRemoved, persistentMessageAdded, persistentMessageRemoved |
| Constructor Detail |
public AbstractConsumerEndpoint(long consumerId,
JmsDestination destination,
java.lang.String selector,
boolean noLocal)
throws javax.jms.InvalidSelectorException
ConsumerEndpoint.
The destination and selector determine where it will be sourcing its
messages from, and scheduler is used to asynchronously deliver messages
to the consumer.consumerId - the identity of this consumerdestination - the destination to accessselector - the message selector. May be nullnoLocal - if true, and the destination is a topic, inhibits the
delivery of messages published by its own connection.javax.jms.InvalidSelectorException - if the selector is not well formed| Method Detail |
public long getId()
getId in interface ConsumerEndpointpublic boolean isPersistent()
getPersistentId() returns a non-null value.isPersistent in interface ConsumerEndpointfalsepublic java.lang.String getPersistentId()
getPersistentId in interface ConsumerEndpointnullpublic JmsDestination getDestination()
getDestination in interface ConsumerEndpointpublic boolean canConsume(JmsDestination destination)
canConsume in interface ConsumerEndpointdestination - the destinationtrue if the consumer can consume messages from
destination; otherwise falsepublic Selector getSelector()
getSelector in interface ConsumerEndpointnull if none was specified
by the clientpublic boolean selects(MessageImpl message)
selects in interface ConsumerEndpointmessage - the message to checktrue if the message is selected; otherwise
falsepublic boolean getNoLocal()
getNoLocal in interface ConsumerEndpointtrue if locally published messages are being
inhibited.
public final MessageHandle receive(Condition cancel)
throws javax.jms.JMSException
receive in interface ConsumerEndpointcancel - null if none is availablejavax.jms.JMSException - for any errorpublic void setAsynchronous(boolean asynchronous)
MessageConsumer with
an associated MessageListener.setAsynchronous in interface ConsumerEndpointasynchronous - if true marks this as an asynchronous
consumerpublic boolean isAsynchronous()
isAsynchronous in interface ConsumerEndpointtrue if this is an asynchronous consumer; otherwise
falsepublic void setWaitingForMessage(Condition condition)
setWaitingForMessage in interface ConsumerEndpointcondition - the condition to evaluate to determine if the client is
waiting for message. May be null.public boolean isWaitingForMessage()
isWaitingForMessage in interface ConsumerEndpointtrue if the client is waiting for messages;
otherwise falsepublic void setListener(ConsumerEndpointListener listener)
setListener in interface ConsumerEndpointlistener - the listener to add, or null to remove an
existing listenerpublic final boolean isClosed()
isClosed in interface ConsumerEndpointtrue if this consumer is closed; otherwise
falsepublic final void close()
close in interface ConsumerEndpointpublic java.lang.String toString()
toString in class java.lang.Object
protected abstract MessageHandle doReceive(Condition cancel)
throws javax.jms.JMSException
close() to be invoked while this method is in
progress. Implementations should therefore invoke isClosed() to determine
if the consumer is in the process of being closed, and if so, return
null.cancel - null if none is availablejavax.jms.JMSException - for any errorprotected abstract void doClose()
protected void notifyMessageAvailable()
protected void setSelector(java.lang.String selector)
throws javax.jms.InvalidSelectorException
selector - the message selector. May be nulljavax.jms.InvalidSelectorException - if the selector is not well formedprotected void setNoLocal(boolean noLocal)
noLocal - if true, locally published messages are
inhibited.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||