|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.j_spaces.jms.GSMessageConsumerImpl
public class GSMessageConsumerImpl
Implements the javax.jms.MessageConsumer
interface.
GigaSpaces implementation of the JMS MessageConsumer Interface
and the Jini RemoteEventListener.
- It holds MessageConsumer Destination, Topic or Queue - It creates the GigaSpaces OnMessageNotifyDelegator and the notify() calls the MessageListener.onMessage() method. - It supports both Synchronized and Asynchronized message consumption. One can use the method receive() for the Synchronized form, or use the NotifyDelegator together with a MessageListener implementation for the Asynchronized message receiving manner.
Field Summary | |
---|---|
String |
m_durableSubscriptionName
The durable consumer subscription name. |
Constructor Summary | |
---|---|
GSMessageConsumerImpl(GSSessionImpl session,
Destination dest,
String consumerID,
String subsriptionName,
String selector,
boolean noLocal)
Constructs a message consumer. |
Method Summary | |
---|---|
void |
close()
Cancels the onMessage notify delegator, using its Lease.cancel() if it is an Asyc operation Also it removes the current consumer from the consumers list held by the session. |
String |
getConsumerID()
Returns the consumer ID. |
Destination |
getDestination()
|
MessageListener |
getMessageListener()
API method. |
String |
getMessageSelector()
API method. |
String |
getName()
Return the durable subscription name |
boolean |
getNoLocal()
|
Queue |
getQueue()
|
Topic |
getTopic()
|
boolean |
isClosed()
Determines if the consumer is closed |
boolean |
isDurableSubscriber()
Determines if the subscriber is durable |
Message |
receive()
API method. |
Message |
receive(long timeout)
API method. |
Message |
receiveNoWait()
API method. |
void |
setMessageListener(MessageListener listener)
This method is called by the JMS Client, it sets the MessageListener implementation and It creates a GigaSpaces NotifyDelegator for Asynchronic messaging. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public String m_durableSubscriptionName
Constructor Detail |
---|
public GSMessageConsumerImpl(GSSessionImpl session, Destination dest, String consumerID, String subsriptionName, String selector, boolean noLocal) throws JMSException
session
- The m_session the consumer belongs to.dest
- The destination the consumer gets messages from.consumerID
- subsriptionName
- The m_durableSubscriber subscription's name, if any.selector
- Selector string for filtering messages.
InvalidSelectorException
- If the m_selector syntax is invalid.
IllegalStateException
- If the connection is broken.
JMSException
- If the creation fails for any other reason.Method Detail |
---|
public String getMessageSelector() throws JMSException
getMessageSelector
in interface MessageConsumer
IllegalStateException
- If the consumer is closed.
JMSException
public MessageListener getMessageListener() throws JMSException
getMessageListener
in interface MessageConsumer
IllegalStateException
- If the consumer is closed.
JMSException
public void setMessageListener(MessageListener listener) throws JMSException
setMessageListener
in interface MessageConsumer
listener
-
IllegalStateException
- If the consumer is closed.
JMSException
MessageConsumer.setMessageListener(javax.jms.MessageListener)
public Message receive() throws JMSException
receive
in interface MessageConsumer
IllegalStateException
- If the consumer is closed, or if the
connection is broken.
JMSSecurityException
- If the requester is not a READER on the
destination.
JMSException
- If the request fails for any other reason.public Message receive(long timeout) throws JMSException
receive
in interface MessageConsumer
timeout
- This call blocks until a message arrives, the
timeout expires, or this message consumer is closed.
The jms client may select A timeout
of zero, that means it never expires,
and the call blocks indefinitely.
It is the same as the Space timeout which its value to Long.MAX_VALUE
Regarding the space timeout, it means how long the client is willing to wait for a
transactionally proper matching entry.
A timeout of IJSpace.NO_WAIT
means to wait no time at all; this is equivalent to a wait of zero (in space only, not in jms).
IllegalStateException
- If the consumer is closed, or if the
connection is broken.
JMSSecurityException
- If the requester is not a READER on the
destination.
JMSException
- If the request fails for any other reason.public Message receiveNoWait() throws JMSException
receiveNoWait
in interface MessageConsumer
IllegalStateException
- If the consumer is closed, or if the
connection is broken.
JMSSecurityException
- If the requester is not a READER on the
destination.
JMSException
- If the request fails for any other reason.public boolean isClosed()
true
if the consumer is closedpublic void close() throws JMSException
close
in interface MessageConsumer
JMSException
MessageConsumer.close()
public String toString()
toString
in class Object
public String getConsumerID()
public String getName()
null
if
this is a non-durable subscriberpublic boolean isDurableSubscriber()
true
if the subscriber is durablepublic Queue getQueue() throws JMSException
getQueue
in interface QueueReceiver
JMSException
QueueReceiver.getQueue()
public boolean getNoLocal() throws JMSException
getNoLocal
in interface TopicSubscriber
JMSException
TopicSubscriber.getNoLocal()
public Topic getTopic() throws JMSException
getTopic
in interface TopicSubscriber
JMSException
TopicSubscriber.getTopic()
public Destination getDestination() throws JMSException
JMSException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |