Package com.webmethods.jms.impl
Class WmSessionSubscriber
- java.lang.Object
-
- com.webmethods.locks.Node
-
- com.webmethods.jms.impl.WmSessionSubscriber
-
- All Implemented Interfaces:
WmMessageConsumer
,WmTopicSubscriber
,javax.jms.MessageConsumer
,javax.jms.TopicSubscriber
- Direct Known Subclasses:
WmClusterSessionSubscriber
public class WmSessionSubscriber extends Node implements WmTopicSubscriber
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
_subscriberClosed
protected java.lang.String
_subscriberDurableName
protected boolean
_subscriberNoLocal
protected java.lang.String
_subscriberSelector
protected WmSessionImpl
_subscriberSession
protected WmTopicImpl
_subscriberTopic
-
Fields inherited from class com.webmethods.locks.Node
_lockManager
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
WmSessionSubscriber(WmSessionImpl session)
Default constructor called from subclasses.protected
WmSessionSubscriber(WmSessionImpl session, WmTopicImpl topic, java.lang.String durableName, java.lang.String selector, boolean noLocal)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description long
available()
Gets the number of messages on the Broker available to the consumer.void
clear()
Clears all available messages to the consumer from the Broker.void
close()
protected static WmSessionSubscriber
create(WmSessionImpl session, WmTopicImpl topic, java.lang.String durableName, java.lang.String selector, boolean noLocal)
javax.jms.Message
getAndAckMessage()
javax.jms.Destination
getDestination()
Get theDestination
associated with this consumer.java.io.InputStream
getInputStream()
Returns an InputStream that reads data from a MessageConsumer.int
getMaxReceive()
Get the maximum receive value for this message consumer.javax.jms.MessageListener
getMessageListener()
java.lang.String
getMessageSelector()
boolean
getNoLocal()
javax.jms.Topic
getTopic()
javax.jms.Message
receive()
javax.jms.Message
receive(long timeout)
javax.jms.Message
receiveNoWait()
void
setMaxReceive(int maxReceive)
Set the maximum receive value for this message consumer.void
setMessageListener(javax.jms.MessageListener listener)
boolean
waitForMessages(long time)
Wait for messages to come to the queue.-
Methods inherited from class com.webmethods.locks.Node
getLockManager, getParent
-
-
-
-
Field Detail
-
_subscriberSession
protected WmSessionImpl _subscriberSession
-
_subscriberTopic
protected WmTopicImpl _subscriberTopic
-
_subscriberDurableName
protected java.lang.String _subscriberDurableName
-
_subscriberSelector
protected java.lang.String _subscriberSelector
-
_subscriberNoLocal
protected boolean _subscriberNoLocal
-
_subscriberClosed
protected boolean _subscriberClosed
-
-
Constructor Detail
-
WmSessionSubscriber
protected WmSessionSubscriber(WmSessionImpl session, WmTopicImpl topic, java.lang.String durableName, java.lang.String selector, boolean noLocal) throws javax.jms.JMSException
- Throws:
javax.jms.JMSException
-
WmSessionSubscriber
protected WmSessionSubscriber(WmSessionImpl session)
Default constructor called from subclasses.
-
-
Method Detail
-
create
protected static WmSessionSubscriber create(WmSessionImpl session, WmTopicImpl topic, java.lang.String durableName, java.lang.String selector, boolean noLocal) throws javax.jms.JMSException
- Throws:
javax.jms.JMSException
-
getMessageSelector
public java.lang.String getMessageSelector() throws javax.jms.JMSException
- Specified by:
getMessageSelector
in interfacejavax.jms.MessageConsumer
- Throws:
javax.jms.JMSException
-
getMessageListener
public javax.jms.MessageListener getMessageListener() throws javax.jms.JMSException
- Specified by:
getMessageListener
in interfacejavax.jms.MessageConsumer
- Throws:
javax.jms.JMSException
-
setMessageListener
public void setMessageListener(javax.jms.MessageListener listener) throws javax.jms.JMSException
- Specified by:
setMessageListener
in interfacejavax.jms.MessageConsumer
- Throws:
javax.jms.JMSException
-
waitForMessages
public boolean waitForMessages(long time)
Wait for messages to come to the queue.
-
getAndAckMessage
public javax.jms.Message getAndAckMessage() throws javax.jms.JMSException
- Throws:
javax.jms.JMSException
-
receive
public javax.jms.Message receive() throws javax.jms.JMSException
- Specified by:
receive
in interfacejavax.jms.MessageConsumer
- Throws:
javax.jms.JMSException
-
receive
public javax.jms.Message receive(long timeout) throws javax.jms.JMSException
- Specified by:
receive
in interfacejavax.jms.MessageConsumer
- Throws:
javax.jms.JMSException
-
receiveNoWait
public javax.jms.Message receiveNoWait() throws javax.jms.JMSException
- Specified by:
receiveNoWait
in interfacejavax.jms.MessageConsumer
- Throws:
javax.jms.JMSException
-
close
public void close() throws javax.jms.JMSException
- Specified by:
close
in interfacejavax.jms.MessageConsumer
- Specified by:
close
in interfaceWmMessageConsumer
- Throws:
javax.jms.JMSException
-
getTopic
public javax.jms.Topic getTopic() throws javax.jms.JMSException
- Specified by:
getTopic
in interfacejavax.jms.TopicSubscriber
- Throws:
javax.jms.JMSException
-
getNoLocal
public boolean getNoLocal() throws javax.jms.JMSException
- Specified by:
getNoLocal
in interfacejavax.jms.TopicSubscriber
- Throws:
javax.jms.JMSException
-
setMaxReceive
public void setMaxReceive(int maxReceive) throws javax.jms.JMSException
Description copied from interface:WmMessageConsumer
Set the maximum receive value for this message consumer. The message consumer will accumulate at most this number of messages at a time.- Specified by:
setMaxReceive
in interfaceWmMessageConsumer
- Parameters:
maxReceive
- the maximum number of messages to be accumulated by this message consumer- Throws:
javax.jms.JMSException
- if the JMS provider fails to set the maximum receive value.- See Also:
WmMessageConsumer.getMaxReceive()
-
getMaxReceive
public int getMaxReceive() throws javax.jms.JMSException
Description copied from interface:WmMessageConsumer
Get the maximum receive value for this message consumer. The message consumer will accumulate at most this number of messages at a time.- Specified by:
getMaxReceive
in interfaceWmMessageConsumer
- Returns:
- the maximum number of messages to be accumulated by this message consumer
- Throws:
javax.jms.JMSException
- if the JMS provider fails to get the maximum receive value.- See Also:
WmMessageConsumer.setMaxReceive(int)
-
getDestination
public javax.jms.Destination getDestination()
Description copied from interface:WmMessageConsumer
Get theDestination
associated with this consumer.- Specified by:
getDestination
in interfaceWmMessageConsumer
- Returns:
- this consumer's
Destination
-
available
public long available()
Description copied from interface:WmMessageConsumer
Gets the number of messages on the Broker available to the consumer. This is an approximate number in that some of the messages may be expired or don't match the consumer's message selector.- Specified by:
available
in interfaceWmMessageConsumer
- Returns:
- the number of messages available to the consumer
-
clear
public void clear()
Description copied from interface:WmMessageConsumer
Clears all available messages to the consumer from the Broker.- Specified by:
clear
in interfaceWmMessageConsumer
-
getInputStream
public java.io.InputStream getInputStream() throws javax.jms.JMSException
Description copied from interface:WmMessageConsumer
Returns an InputStream that reads data from a MessageConsumer.- Specified by:
getInputStream
in interfaceWmMessageConsumer
- Returns:
- an InputStream
- Throws:
javax.jms.JMSException
- if the MessageConsumer's InputStream could not be returned.
-
-