|
||||||||||
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 null
noLocal
- 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 formedMethod Detail |
public long getId()
getId
in interface ConsumerEndpoint
public boolean isPersistent()
getPersistentId()
returns a non-null value.isPersistent
in interface ConsumerEndpoint
false
public java.lang.String getPersistentId()
getPersistentId
in interface ConsumerEndpoint
null
public JmsDestination getDestination()
getDestination
in interface ConsumerEndpoint
public boolean canConsume(JmsDestination destination)
canConsume
in interface ConsumerEndpoint
destination
- the destinationtrue
if the consumer can consume messages from
destination
; otherwise false
public Selector getSelector()
getSelector
in interface ConsumerEndpoint
null
if none was specified
by the clientpublic boolean selects(MessageImpl message)
selects
in interface ConsumerEndpoint
message
- the message to checktrue
if the message is selected; otherwise
false
public boolean getNoLocal()
getNoLocal
in interface ConsumerEndpoint
true
if locally published messages are being
inhibited.public final MessageHandle receive(Condition cancel) throws javax.jms.JMSException
receive
in interface ConsumerEndpoint
cancel
- null
if none is availablejavax.jms.JMSException
- for any errorpublic void setAsynchronous(boolean asynchronous)
MessageConsumer
with
an associated MessageListener
.setAsynchronous
in interface ConsumerEndpoint
asynchronous
- if true
marks this as an asynchronous
consumerpublic boolean isAsynchronous()
isAsynchronous
in interface ConsumerEndpoint
true
if this is an asynchronous consumer; otherwise
false
public void setWaitingForMessage(Condition condition)
setWaitingForMessage
in interface ConsumerEndpoint
condition
- the condition to evaluate to determine if the client is
waiting for message. May be null
.public boolean isWaitingForMessage()
isWaitingForMessage
in interface ConsumerEndpoint
true
if the client is waiting for messages;
otherwise false
public void setListener(ConsumerEndpointListener listener)
setListener
in interface ConsumerEndpoint
listener
- the listener to add, or null
to remove an
existing listenerpublic final boolean isClosed()
isClosed
in interface ConsumerEndpoint
true
if this consumer is closed; otherwise
false
public final void close()
close
in interface ConsumerEndpoint
public 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 null
javax.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 |