Class WmClusterSessionImpl
- java.lang.Object
-
- com.webmethods.locks.Node
-
- com.webmethods.jms.impl.WmSessionImpl
-
- com.webmethods.jms.loadbalance.connection.WmClusterSessionImpl
-
- All Implemented Interfaces:
WmSession
,java.lang.Runnable
,javax.jms.Session
- Direct Known Subclasses:
WmClusterQueueSessionImpl
,WmClusterTopicSessionImpl
,WmClusterXASessionImpl
,WmCompositeClusterSessionImpl
public class WmClusterSessionImpl extends WmSessionImpl
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.webmethods.jms.impl.WmSessionImpl
WmSessionImpl.SessionDispatcher
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Set<WmSessionImpl>
activeSubSessions
static java.lang.String
COMMITED
static java.lang.String
COMMITING
protected WmClusterConnectionImpl
conn
protected java.lang.String
currentBrokerURL
protected java.util.HashMap<java.lang.String,WmSessionImpl>
map
protected int
policy
static java.lang.String
PREPARED
static java.lang.String
PREPARING
protected java.util.Random
random
protected java.util.concurrent.LinkedBlockingQueue<WmMessageImpl>
sharedQueue
protected java.util.concurrent.locks.ReentrantReadWriteLock
sharedReadWriteLock
protected java.util.Vector<WmSessionImpl>
subSessions
static java.lang.String
TENTATIVE
-
Fields inherited from class com.webmethods.jms.impl.WmSessionImpl
_acknowledgeMode, _closed, _closeInProgress, _connection, _currentAsyncMessage, _isXA, _logApi, _messageConsumers, _messageListener, _messageProducers, _messageQueue, _newMessageListeners, _sessionDispatcher, _sessionDispatcherCount, _sessionReconnect, _sessionSubscriberMessageConsumers, _transacted, _transactionID, _transactionTimeout, _xid, brokerName, DEFAULT_TRANSACTION_TIMEOUT
-
Fields inherited from class com.webmethods.locks.Node
_lockManager
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
WmClusterSessionImpl(WmConnectionImpl connection)
Default constructor for subclasses.protected
WmClusterSessionImpl(WmClusterConnectionImpl connection, boolean transacted, boolean isXA, int acknowledgeMode)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addMessageConsumer(WmMessageConsumerImpl messageConsumer)
void
addMessageToQueue(WmMessageImpl message)
Adds the message into the message queue.void
addSessionSubscriberMessageConsumer(WmMessageConsumer messageConsumer)
void
addToSubSessions(WmSessionImpl session)
protected void
checkCreateDurableConsumer(javax.jms.Destination destination)
void
checkState()
void
clearOnTransactionComplete()
Clears the currentBrokerURL to mark the transaction complete/rollback.void
close()
Closes the subsessions and will be blocked until all session close calls return.void
commit()
Commits all messages done in this transaction and releases any locks currently held.javax.jms.QueueBrowser
createBrowser(javax.jms.Queue queue)
Creates aQueueBrowser
object to peek at the messages on the specified queue on the cluster.javax.jms.QueueBrowser
createBrowser(javax.jms.Queue queue, java.lang.String messageSelector)
Creates aQueueBrowser
object to peek at the messages on the specified cluster queue using a message selector.javax.jms.MessageConsumer
createConsumer(javax.jms.Destination destination)
Creates aMessageConsumer
for the specified destinations on the Broker Cluster.javax.jms.MessageConsumer
createConsumer(javax.jms.Destination destination, java.lang.String messageSelector)
Creates aMessageConsumer
for the specified destination, on the Broker Cluster using a message selector.javax.jms.MessageConsumer
createConsumer(javax.jms.Destination destination, java.lang.String messageSelector, boolean noLocal)
CreatesMessageConsumer
for the specified destination, using a message selector.javax.jms.TopicSubscriber
createDurableSubscriber(javax.jms.Topic topic, java.lang.String name)
Creates a durable subscriber to the specified topic.javax.jms.TopicSubscriber
createDurableSubscriber(javax.jms.Topic topic, java.lang.String name, java.lang.String messageSelector, boolean noLocal)
Creates a durable subscriber to the specified topic, using a message selector and specifying whether messages published by its own connection should be delivered to it.javax.jms.Queue
createQueue(java.lang.String queueName)
Creates a queue identity on the Cluster given aQueue
name.protected WmQueueBrowserImpl
createQueueBrowserImpl(WmQueueImpl queue, java.lang.String messageSelector)
Creates a queue implementation instance.javax.jms.QueueReceiver
createReceiver(javax.jms.Queue queue)
Creates aQueueReceiver
object to receive messages from the specified queues in the cluster.javax.jms.QueueReceiver
createReceiver(javax.jms.Queue queue, java.lang.String messageSelector)
Creates aQueueReceiver
object to receive messages from the specified cluster queue using a message selector.javax.jms.TopicSubscriber
createSubscriber(javax.jms.Topic topic)
Creates a nondurable subscriber to the specified topics on the cluster.javax.jms.TopicSubscriber
createSubscriber(javax.jms.Topic topic, java.lang.String messageSelector, boolean noLocal)
Creates a nondurable subscriber to the specified topic on the Broker Cluster, using a message selector or specifying whether messages published by its own connection should be delivered to it.WmSessionImpl
createSubSession(WmConnectionImpl conn)
javax.jms.TemporaryQueue
createTemporaryQueue()
Creates aTemporaryQueue
object.javax.jms.TemporaryQueue
createTemporaryQueue(java.lang.String queueName)
javax.jms.TemporaryTopic
createTemporaryTopic()
Creates aTemporaryTopic
object.javax.jms.TemporaryTopic
createTemporaryTopic(javax.jms.Destination destination)
javax.jms.Topic
createTopic(java.lang.String topicName)
Creates a topic identity given aTopic
name.WmSessionImpl
getBrokerSessionIfActive(java.lang.String brokerURL)
java.lang.String
getCurrentBrokerURL()
javax.jms.MessageListener
getMessageListener()
Returns the cluster session's distinguished message listener (optional).java.util.List<java.lang.String>
getNextBrokerToPublish()
java.util.List<java.lang.String>
getRemainingBrokersToPublish()
java.util.Vector<WmSessionImpl>
getSubSessions()
boolean
getTransacted()
Indicates whether the cluster session is in transacted mode.protected int[]
initMultiSendBestEffortSeeder(int size)
boolean
isXA()
returns whether the cluster session is in XA mode.void
logActiveClusterSessions()
void
publish(WmMessageImpl[] messages, int deliveryMode, boolean deliver)
Publishes a message to one of the JMS connections.void
publish(WmMessageImpl message, int deliveryMode, boolean deliver)
Publishes a message to one of the JMS connections.void
publishToWorker(WmMessageImpl[] messages, int deliveryMode, boolean deliver, java.lang.String brokerURL, boolean overrideClusterPolicy, boolean fallBackToPolicy)
void
recover()
Stops message delivery in this cluster session, and restarts message delivery with the oldest unacknowledged message.void
removeMessageConsumer(WmMessageConsumerImpl messageConsumer)
void
removeSessionSubscriberMessageConsumer(WmMessageConsumer messageConsumer)
void
rollback()
Rolls back any messages done in this transaction and releases any locks currently held.void
run()
Optional operation, intended to be used only by Application Servers, not by ordinary JMS clients.protected void
selectPrimaryWithRotation(java.lang.Object[] arr)
void
sessionAcknowledge()
void
sessionAcknowledge(boolean preAck)
Acknowledge all received but unacknowledged messages on this cluster session.void
setCurrentBrokerURL(java.lang.String brokerUrl)
void
setMessageListener(javax.jms.MessageListener listener)
Sets the session's distinguished message listener (optional).void
setMessageQueue(WmSessionQueue queue)
Added to change the implementation of the WmSessionQueue to the WmClusterSessionQueueImpl incase of cluster sessionsvoid
start()
Starts synchronous and asynchronous message delivery.void
stop()
Stops synchronous and asynchronous message delivery.java.lang.String
toString()
void
unsubscribe(java.lang.String name)
Unsubscribes a durable subscription that has been created by the cluster client.void
unsubscribe(java.lang.String name, boolean force)
Unsubscribes a durable subscription that has been created by the cluster client.-
Methods inherited from class com.webmethods.jms.impl.WmSessionImpl
addMessageProducer, checkCreateConsumer, checkCreateProducer, checkForClusteringSupport, closeMessageConsumers, closeMessageProducers, createBytesMessage, createFileMessage, createMapMessage, createMessage, createObjectMessage, createObjectMessage, createProducer, createPublisher, createSender, createStreamMessage, createTextMessage, createTextMessage, get_messageQueue, get_transactionID, getAcknowledgeMode, getBrokerName, getConnection, getDurableSubscriber, getExceptionListener, getMessageConsumers, getSessionDispatcherThreadID, getTemporaryQueueName, getTemporaryTopicName, invokeExceptionListener, isTransacted, prepare, prepare, recoverInternal, removeMessageProducer, sessionAcknowledgeInternal, setCurrentAsynMessage, setExceptionListener, setMessageListener, validAcknowledgeMode
-
Methods inherited from class com.webmethods.locks.Node
getLockManager, getParent
-
-
-
-
Field Detail
-
TENTATIVE
public static final java.lang.String TENTATIVE
- See Also:
- Constant Field Values
-
subSessions
protected java.util.Vector<WmSessionImpl> subSessions
-
policy
protected int policy
-
conn
protected WmClusterConnectionImpl conn
-
map
protected java.util.HashMap<java.lang.String,WmSessionImpl> map
-
random
protected java.util.Random random
-
currentBrokerURL
protected java.lang.String currentBrokerURL
-
activeSubSessions
protected java.util.Set<WmSessionImpl> activeSubSessions
-
sharedReadWriteLock
protected java.util.concurrent.locks.ReentrantReadWriteLock sharedReadWriteLock
-
sharedQueue
protected java.util.concurrent.LinkedBlockingQueue<WmMessageImpl> sharedQueue
-
PREPARING
public static final java.lang.String PREPARING
- See Also:
- Constant Field Values
-
PREPARED
public static final java.lang.String PREPARED
- See Also:
- Constant Field Values
-
COMMITING
public static final java.lang.String COMMITING
- See Also:
- Constant Field Values
-
COMMITED
public static final java.lang.String COMMITED
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
WmClusterSessionImpl
protected WmClusterSessionImpl(WmConnectionImpl connection)
Default constructor for subclasses.
-
WmClusterSessionImpl
protected WmClusterSessionImpl(WmClusterConnectionImpl connection, boolean transacted, boolean isXA, int acknowledgeMode) throws javax.jms.JMSException
- Throws:
javax.jms.JMSException
-
-
Method Detail
-
createSubSession
public WmSessionImpl createSubSession(WmConnectionImpl conn) throws javax.jms.JMSException
- Throws:
javax.jms.JMSException
-
start
public void start() throws javax.jms.JMSException
Description copied from class:WmSessionImpl
Starts synchronous and asynchronous message delivery. Called byConnection.start()
.- Overrides:
start
in classWmSessionImpl
- Throws:
javax.jms.JMSException
-
stop
public void stop() throws javax.jms.JMSException
Description copied from class:WmSessionImpl
Stops synchronous and asynchronous message delivery. Called byConnection.stop()
.- Overrides:
stop
in classWmSessionImpl
- Throws:
javax.jms.JMSException
-
getSubSessions
public java.util.Vector<WmSessionImpl> getSubSessions()
-
getCurrentBrokerURL
public java.lang.String getCurrentBrokerURL()
-
setCurrentBrokerURL
public void setCurrentBrokerURL(java.lang.String brokerUrl)
-
close
public void close() throws javax.jms.JMSException
Closes the subsessions and will be blocked until all session close calls return.- Specified by:
close
in interfacejavax.jms.Session
- Overrides:
close
in classWmSessionImpl
- Throws:
javax.jms.JMSException
-
setMessageQueue
public void setMessageQueue(WmSessionQueue queue)
Added to change the implementation of the WmSessionQueue to the WmClusterSessionQueueImpl incase of cluster sessions- Overrides:
setMessageQueue
in classWmSessionImpl
- Parameters:
queue
-
-
removeMessageConsumer
public void removeMessageConsumer(WmMessageConsumerImpl messageConsumer)
- Overrides:
removeMessageConsumer
in classWmSessionImpl
-
removeSessionSubscriberMessageConsumer
public void removeSessionSubscriberMessageConsumer(WmMessageConsumer messageConsumer)
- Overrides:
removeSessionSubscriberMessageConsumer
in classWmSessionImpl
-
commit
public void commit() throws javax.jms.JMSException
Description copied from class:WmSessionImpl
Commits all messages done in this transaction and releases any locks currently held.- Specified by:
commit
in interfacejavax.jms.Session
- Overrides:
commit
in classWmSessionImpl
- Throws:
javax.jms.JMSException
- if the JMS provider fails to commit the transaction due to some internal error.javax.jms.TransactionRolledBackException
- if the transaction is rolled back due to some internal error during commit.javax.jms.IllegalStateException
- if the method is not called by a transacted session.
-
recover
public void recover() throws javax.jms.JMSException
Stops message delivery in this cluster session, and restarts message delivery with the oldest unacknowledged message.- Specified by:
recover
in interfacejavax.jms.Session
- Overrides:
recover
in classWmSessionImpl
- Throws:
javax.jms.JMSException
- if the JMS provider fails to stop and restart message delivery due to some internal error.javax.jms.IllegalStateException
- if the method is called by a transacted session.
-
rollback
public void rollback() throws javax.jms.JMSException
Description copied from class:WmSessionImpl
Rolls back any messages done in this transaction and releases any locks currently held.- Specified by:
rollback
in interfacejavax.jms.Session
- Overrides:
rollback
in classWmSessionImpl
- Throws:
javax.jms.JMSException
- if the JMS provider fails to roll back the transaction due to some internal error.javax.jms.IllegalStateException
- if the method is not called by a transacted session.
-
clearOnTransactionComplete
public void clearOnTransactionComplete()
Clears the currentBrokerURL to mark the transaction complete/rollback.
-
createConsumer
public javax.jms.MessageConsumer createConsumer(javax.jms.Destination destination, java.lang.String messageSelector, boolean noLocal) throws javax.jms.JMSException
CreatesMessageConsumer
for the specified destination, using a message selector. This method can specify whether messages published by its own connection should be delivered to it, if the destination is a topic.Since
Queue
andTopic
both inherit fromDestination
, they can be used in the destination parameter to create aMessageConsumer
.A client uses a
MessageConsumer
object to receive messages that have been published to a destination.In some cases, a connection may both publish and subscribe to a topic. The consumer
noLocal
attribute allows a consumer to inhibit the delivery of messages published by its own connection. The default value for this attribute is False. ThenoLocal
value must be supported by destinations that are topics.- Specified by:
createConsumer
in interfacejavax.jms.Session
- Overrides:
createConsumer
in classWmSessionImpl
- Parameters:
destination
- theDestination
to accessmessageSelector
- only messages with properties matching the message selector expression are delivered. A value of null or an empty string indicates that there is no message selector for the message consumer.noLocal
- - if true, and the destination is a topic, inhibits the delivery of messages published by its own connection. The behavior fornoLocal
is not specified if the destination is a queue.- Throws:
javax.jms.JMSException
- if the session fails to create a MessageConsumer due to some internal error.javax.jms.InvalidDestinationException
- if an invalid destination is specified.javax.jms.InvalidSelectorException
- if the message selector is invalid.
-
createDurableSubscriber
public javax.jms.TopicSubscriber createDurableSubscriber(javax.jms.Topic topic, java.lang.String name, java.lang.String messageSelector, boolean noLocal) throws javax.jms.JMSException
Creates a durable subscriber to the specified topic, using a message selector and specifying whether messages published by its own connection should be delivered to it.If a client needs to receive all the messages published on a topic, including the ones published while the subscriber is inactive, it uses a durable
TopicSubscriber
. The JMS provider retains a record of this durable subscription and insures that all messages from the topic's publishers are retained until they are acknowledged by this durable subscriber or they have expired.Sessions with durable subscribers must always provide the same client identifier. In addition, each client must specify a name which uniquely identifies (within client identifier) each durable subscription it creates. Only one session at a time can have a
TopicSubscriber
for a particular durable subscription. An inactive durable subscriber is one that exists but does not currently have a message consumer associated with it.A client can change an existing durable subscription by creating a durable
TopicSubscriber
with the same name and a new topic and/or message selector. Changing a durable subscriber is equivalent to unsubscribing (deleting) the old one and creating a new one.- Specified by:
createDurableSubscriber
in interfacejavax.jms.Session
- Overrides:
createDurableSubscriber
in classWmSessionImpl
- Parameters:
topic
- the non-temporaryTopic
to subscribe toname
- the name used to identify this subscriptionmessageSelector
- only messages with properties matching the message selector expression are delivered. A value of null or an empty string indicates that there is no message selector for the message consumer.noLocal
- if set, inhibits the delivery of messages published by its own connection- Throws:
javax.jms.JMSException
- if the session fails to create a subscriber due to some internal error.javax.jms.InvalidDestinationException
- if an invalid topic is specified.javax.jms.InvalidSelectorException
- if the message selector is invalid.
-
createBrowser
public javax.jms.QueueBrowser createBrowser(javax.jms.Queue queue, java.lang.String messageSelector) throws javax.jms.JMSException
Creates aQueueBrowser
object to peek at the messages on the specified cluster queue using a message selector.- Specified by:
createBrowser
in interfacejavax.jms.Session
- Overrides:
createBrowser
in classWmSessionImpl
- Parameters:
queue
- thequeue
to accessmessageSelector
- only messages with properties matching the message selector expression are delivered. A value of null or an empty string indicates that there is no message selector for the message consumer.- Throws:
javax.jms.JMSException
- if the session fails to create a browser due to some internal error.javax.jms.InvalidDestinationException
- if an invalid destination is specifiedjavax.jms.InvalidSelectorException
- if the message selector is invalid.
-
createQueueBrowserImpl
protected WmQueueBrowserImpl createQueueBrowserImpl(WmQueueImpl queue, java.lang.String messageSelector) throws javax.jms.JMSException
Creates a queue implementation instance.- Overrides:
createQueueBrowserImpl
in classWmSessionImpl
- Parameters:
queue
-messageSelector
-- Throws:
javax.jms.JMSException
-
createTemporaryQueue
public javax.jms.TemporaryQueue createTemporaryQueue() throws javax.jms.JMSException
Creates aTemporaryQueue
object. Its lifetime will be that of theConnection
unless it is deleted earlier.- Specified by:
createTemporaryQueue
in interfacejavax.jms.Session
- Overrides:
createTemporaryQueue
in classWmSessionImpl
- Returns:
- a temporary queue identity
- Throws:
javax.jms.JMSException
- if the session fails to create a temporary queue due to some internal error.
-
createTemporaryQueue
public javax.jms.TemporaryQueue createTemporaryQueue(java.lang.String queueName) throws javax.jms.JMSException
- Overrides:
createTemporaryQueue
in classWmSessionImpl
- Throws:
javax.jms.JMSException
-
createTemporaryTopic
public javax.jms.TemporaryTopic createTemporaryTopic() throws javax.jms.JMSException
Creates aTemporaryTopic
object. Its lifetime will be that of theConnection
unless it is deleted earlier.- Specified by:
createTemporaryTopic
in interfacejavax.jms.Session
- Overrides:
createTemporaryTopic
in classWmSessionImpl
- Returns:
- a temporary topic identity
- Throws:
javax.jms.JMSException
- if the session fails to create a temporary topic due to some internal error.
-
createTemporaryTopic
public javax.jms.TemporaryTopic createTemporaryTopic(javax.jms.Destination destination) throws javax.jms.JMSException
- Throws:
javax.jms.JMSException
-
toString
public java.lang.String toString()
- Overrides:
toString
in classWmSessionImpl
-
publish
public void publish(WmMessageImpl message, int deliveryMode, boolean deliver) throws javax.jms.JMSException
Publishes a message to one of the JMS connections. Overwrite the superclass publish logics.- Overrides:
publish
in classWmSessionImpl
- Parameters:
message
-deliveryMode
-deliver
-- Throws:
javax.jms.JMSException
-
publishToWorker
public void publishToWorker(WmMessageImpl[] messages, int deliveryMode, boolean deliver, java.lang.String brokerURL, boolean overrideClusterPolicy, boolean fallBackToPolicy) throws javax.jms.JMSException
- Throws:
javax.jms.JMSException
-
getRemainingBrokersToPublish
public java.util.List<java.lang.String> getRemainingBrokersToPublish() throws javax.jms.JMSException
- Throws:
javax.jms.JMSException
-
getNextBrokerToPublish
public java.util.List<java.lang.String> getNextBrokerToPublish() throws javax.jms.JMSException
- Throws:
javax.jms.JMSException
-
publish
public void publish(WmMessageImpl[] messages, int deliveryMode, boolean deliver) throws javax.jms.JMSException
Publishes a message to one of the JMS connections. Overwrite the superclass publish logics.- Overrides:
publish
in classWmSessionImpl
- Parameters:
messages
-deliveryMode
-deliver
-- Throws:
javax.jms.JMSException
-
initMultiSendBestEffortSeeder
protected int[] initMultiSendBestEffortSeeder(int size)
-
selectPrimaryWithRotation
protected void selectPrimaryWithRotation(java.lang.Object[] arr)
-
sessionAcknowledge
public void sessionAcknowledge() throws javax.jms.JMSException
- Overrides:
sessionAcknowledge
in classWmSessionImpl
- Throws:
javax.jms.JMSException
-
sessionAcknowledge
public void sessionAcknowledge(boolean preAck) throws javax.jms.JMSException
Acknowledge all received but unacknowledged messages on this cluster session. Only takes effect if the session is in CLIENT_ACKNOWLEDGE acknowledgment mode. Called byWmMessageImpl.acknowledge()
.- Throws:
javax.jms.JMSException
-
unsubscribe
public void unsubscribe(java.lang.String name) throws javax.jms.JMSException
Unsubscribes a durable subscription that has been created by the cluster client.This method deletes the state being maintained on behalf of the subscriber by the cluster. * @param name the name used to identify this subscription
- Specified by:
unsubscribe
in interfacejavax.jms.Session
- Overrides:
unsubscribe
in classWmSessionImpl
- Parameters:
name
- the name used to identify this subscription- Throws:
javax.jms.JMSException
- if the session fails to unsubscribe to the durable subscription due to some internal error.javax.jms.InvalidDestinationException
- if an invalid subscription name is specified.
-
unsubscribe
public void unsubscribe(java.lang.String name, boolean force) throws javax.jms.JMSException
Unsubscribes a durable subscription that has been created by the cluster client.This method deletes the state being maintained on behalf of the subscriber by the Cluster.
- Overrides:
unsubscribe
in classWmSessionImpl
- Parameters:
name
- the name used to identify this subscriptionforce
-true
to forcibly unsubscribe even if the subscriber has consumed messages that are a part of the pending transaction or has not been acknowledged in the session- Throws:
javax.jms.JMSException
- if the session fails to unsubscribe to the durable subscription due to some internal error.javax.jms.InvalidDestinationException
- if an invalid subscription name is specified.
-
createDurableSubscriber
public javax.jms.TopicSubscriber createDurableSubscriber(javax.jms.Topic topic, java.lang.String name) throws javax.jms.JMSException
Description copied from class:WmSessionImpl
Creates a durable subscriber to the specified topic.If a client needs to receive all the messages published on a topic, including the ones published while the subscriber is inactive, it uses a durable
TopicSubscriber
. The JMS provider retains a record of this durable subscription and insures that all messages from the topic's publishers are retained until they are acknowledged by this durable subscriber or they have expired.Sessions with durable subscribers must always provide the same client identifier. In addition, each client must specify a name that uniquely identifies (within client identifier) each durable subscription it creates. Only one session at a time can have a
TopicSubscriber
for a particular durable subscription.A client can change an existing durable subscription by creating a durable
TopicSubscriber
with the same name and a new topic and/or message selector. Changing a durable subscriber is equivalent to unsubscribing (deleting) the old one and creating a new one.In some cases, a connection may both publish and subscribe to a topic. The subscriber
noLocal
attribute allows a subscriber to inhibit the delivery of messages published by its own connection. The default value for this attribute is false.- Specified by:
createDurableSubscriber
in interfacejavax.jms.Session
- Overrides:
createDurableSubscriber
in classWmSessionImpl
- Parameters:
topic
- the non-temporaryTopic
to subscribe toname
- the name used to identify this subscription- Throws:
javax.jms.JMSException
- if the session fails to create a subscriber due to some internal error.javax.jms.InvalidDestinationException
- if an invalid topic is specified.
-
checkState
public void checkState() throws javax.jms.JMSException
- Overrides:
checkState
in classWmSessionImpl
- Throws:
javax.jms.JMSException
-
createReceiver
public javax.jms.QueueReceiver createReceiver(javax.jms.Queue queue) throws javax.jms.JMSException
Creates aQueueReceiver
object to receive messages from the specified queues in the cluster.- Overrides:
createReceiver
in classWmSessionImpl
- Parameters:
queue
- theQueue
to access- Throws:
javax.jms.JMSException
- if the cluster session fails to create a receiver due to some internal error.javax.jms.InvalidDestinationException
- if an invalid queue is specified.
-
createReceiver
public javax.jms.QueueReceiver createReceiver(javax.jms.Queue queue, java.lang.String messageSelector) throws javax.jms.JMSException
Creates aQueueReceiver
object to receive messages from the specified cluster queue using a message selector.- Overrides:
createReceiver
in classWmSessionImpl
- Parameters:
queue
- theQueue
to accessmessageSelector
- only messages with properties matching the message selector expression are delivered. A value of null or an empty string indicates that there is no message selector for the message consumer.- Throws:
javax.jms.JMSException
- if the session fails to create a receiver due to some internal error.javax.jms.InvalidDestinationException
- if an invalid queue is specified.javax.jms.InvalidSelectorException
- if the message selector is invalid.
-
createBrowser
public javax.jms.QueueBrowser createBrowser(javax.jms.Queue queue) throws javax.jms.JMSException
Creates aQueueBrowser
object to peek at the messages on the specified queue on the cluster.- Specified by:
createBrowser
in interfacejavax.jms.Session
- Overrides:
createBrowser
in classWmSessionImpl
- Parameters:
queue
- thequeue
to access- Throws:
javax.jms.JMSException
- if the session fails to create a browser due to some internal error.javax.jms.InvalidDestinationException
- if an invalid destination is specified
-
checkCreateDurableConsumer
protected void checkCreateDurableConsumer(javax.jms.Destination destination) throws javax.jms.JMSException
- Overrides:
checkCreateDurableConsumer
in classWmSessionImpl
- Throws:
javax.jms.JMSException
-
createConsumer
public javax.jms.MessageConsumer createConsumer(javax.jms.Destination destination) throws javax.jms.JMSException
Creates aMessageConsumer
for the specified destinations on the Broker Cluster. SinceQueue
andTopic
both inherit fromDestination
, they can be used in the destination parameter to create aMessageConsumer
.- Specified by:
createConsumer
in interfacejavax.jms.Session
- Overrides:
createConsumer
in classWmSessionImpl
- Parameters:
destination
- theDestination
to access.- Throws:
javax.jms.JMSException
- if the session fails to create a consumer due to some internal error.javax.jms.InvalidDestinationException
- if an invalid destination is specified.
-
createConsumer
public javax.jms.MessageConsumer createConsumer(javax.jms.Destination destination, java.lang.String messageSelector) throws javax.jms.JMSException
Creates aMessageConsumer
for the specified destination, on the Broker Cluster using a message selector. SinceQueue
andTopic
both inherit fromDestination
, they can be used in the destination parameter to create aMessageConsumer
.A client uses a
MessageConsumer
object to receive messages that have been sent to a destination.- Specified by:
createConsumer
in interfacejavax.jms.Session
- Overrides:
createConsumer
in classWmSessionImpl
- Parameters:
destination
- theDestination
to accessmessageSelector
- only messages with properties matching the message selector expression are delivered. A value of null or an empty string indicates that there is no message selector for the message consumer.- Throws:
javax.jms.JMSException
- if the session fails to create a MessageConsumer due to some internal error.javax.jms.InvalidDestinationException
- if an invalid destination is specified.javax.jms.InvalidSelectorException
- if the message selector is invalid.
-
createSubscriber
public javax.jms.TopicSubscriber createSubscriber(javax.jms.Topic topic) throws javax.jms.JMSException
Creates a nondurable subscriber to the specified topics on the cluster.A client uses a
TopicSubscriber
object to receive messages that have been published to a topic.- Overrides:
createSubscriber
in classWmSessionImpl
- Parameters:
topic
- theTopic
to subscribe to- Throws:
javax.jms.JMSException
- if the session fails to create a subscriber due to some internal error.javax.jms.InvalidDestinationException
- if an invalid topic is specified.
-
createSubscriber
public javax.jms.TopicSubscriber createSubscriber(javax.jms.Topic topic, java.lang.String messageSelector, boolean noLocal) throws javax.jms.JMSException
Creates a nondurable subscriber to the specified topic on the Broker Cluster, using a message selector or specifying whether messages published by its own connection should be delivered to it.Messages filtered out by a subscriber's message selector will never be delivered to the subscriber. From the subscriber's perspective, they do not exist. * @param topic the
Topic
to subscribe to on the cluster- Overrides:
createSubscriber
in classWmSessionImpl
- Parameters:
messageSelector
- only messages with properties matching the message selector expression are delivered. A value of null or an empty string indicates that there is no message selector for the message consumer.noLocal
- if set, inhibits the delivery of messages published by its own connectiontopic
- theTopic
to subscribe to- Throws:
javax.jms.JMSException
- if the session fails to create a subscriber due to some internal error.javax.jms.InvalidDestinationException
- if an invalid topic is specified.javax.jms.InvalidSelectorException
- if the message selector is invalid.
-
getTransacted
public boolean getTransacted() throws javax.jms.JMSException
Indicates whether the cluster session is in transacted mode.- Specified by:
getTransacted
in interfacejavax.jms.Session
- Overrides:
getTransacted
in classWmSessionImpl
- Returns:
- true if the cluster session is in transacted mode
- Throws:
javax.jms.JMSException
- if the JMS provider fails to return the transaction mode due to some internal error.
-
isXA
public boolean isXA() throws javax.jms.JMSException
returns whether the cluster session is in XA mode.- Throws:
javax.jms.JMSException
-
addMessageConsumer
public void addMessageConsumer(WmMessageConsumerImpl messageConsumer)
- Overrides:
addMessageConsumer
in classWmSessionImpl
-
addSessionSubscriberMessageConsumer
public void addSessionSubscriberMessageConsumer(WmMessageConsumer messageConsumer)
- Overrides:
addSessionSubscriberMessageConsumer
in classWmSessionImpl
-
setMessageListener
public void setMessageListener(javax.jms.MessageListener listener) throws javax.jms.JMSException
Sets the session's distinguished message listener (optional).When the distinguished message listener is set, no other form of message receipt in the session can be used; however, all forms of sending messages are still supported.
This is an expert facility not used by regular JMS clients.
- Specified by:
setMessageListener
in interfacejavax.jms.Session
- Overrides:
setMessageListener
in classWmSessionImpl
- Parameters:
listener
- the message listener to associate with this session- Throws:
javax.jms.JMSException
- if the JMS provider fails to set the message listener due to an internal error.
-
run
public void run()
Optional operation, intended to be used only by Application Servers, not by ordinary JMS clients.- Specified by:
run
in interfacejava.lang.Runnable
- Specified by:
run
in interfacejavax.jms.Session
- Overrides:
run
in classWmSessionImpl
-
getMessageListener
public javax.jms.MessageListener getMessageListener() throws javax.jms.JMSException
Returns the cluster session's distinguished message listener (optional).- Specified by:
getMessageListener
in interfacejavax.jms.Session
- Overrides:
getMessageListener
in classWmSessionImpl
- Returns:
- the message listener associated with this cluster session
- Throws:
javax.jms.JMSException
- if the JMS provider fails to get the message listener due to an internal error.
-
createQueue
public javax.jms.Queue createQueue(java.lang.String queueName) throws javax.jms.JMSException
Creates a queue identity on the Cluster given aQueue
name.This facility is provided for the rare cases where clients need to dynamically manipulate queue identity. It allows the creation of a queue identity with a provider-specific name. Clients that depend on this ability are not portable.
Note that this method is not for creating the physical queue. The physical creation of queues is an administrative task and is not to be initiated by the JMS API. The one exception is the creation of temporary queues, which is accomplished with the
createTemporaryQueue
method.- Specified by:
createQueue
in interfacejavax.jms.Session
- Overrides:
createQueue
in classWmSessionImpl
- Parameters:
queueName
- the name of thisQueue
- Returns:
- a
Queue
with the given name - Throws:
javax.jms.JMSException
- if the session fails to create a queue due to some internal error.
-
createTopic
public javax.jms.Topic createTopic(java.lang.String topicName) throws javax.jms.JMSException
Creates a topic identity given aTopic
name.This facility is provided for the rare cases where clients need to dynamically manipulate topic identity. This allows the creation of a topic identity with a provider-specific name. Clients that depend on this ability are not portable.
Note that this method is not for creating the physical topic. The physical creation of topics is an administrative task and is not to be initiated by the JMS API. The one exception is the creation of temporary topics, which is accomplished with the
createTemporaryTopic
method.- Specified by:
createTopic
in interfacejavax.jms.Session
- Overrides:
createTopic
in classWmSessionImpl
- Parameters:
topicName
- the name of thisTopic
- Returns:
- a
Topic
with the given name - Throws:
javax.jms.JMSException
- if the session fails to create a topic due to some internal error.
-
getBrokerSessionIfActive
public WmSessionImpl getBrokerSessionIfActive(java.lang.String brokerURL)
-
addMessageToQueue
public void addMessageToQueue(WmMessageImpl message)
Adds the message into the message queue.- Overrides:
addMessageToQueue
in classWmSessionImpl
- Parameters:
message
-
-
addToSubSessions
public void addToSubSessions(WmSessionImpl session)
-
logActiveClusterSessions
public void logActiveClusterSessions()
-
-