Class ActiveMQSession
- java.lang.Object
-
- org.apache.activemq.artemis.jms.client.ActiveMQSession
-
- All Implemented Interfaces:
java.lang.AutoCloseable,java.lang.Runnable,javax.jms.QueueSession,javax.jms.Session,javax.jms.TopicSession
- Direct Known Subclasses:
ActiveMQXASession
public class ActiveMQSession extends java.lang.Object implements javax.jms.QueueSession, javax.jms.TopicSessionActiveMQ Artemis implementation of a JMS Session.
Note that we *do not* support JMS ASF (Application Server Facilities) optional constructs such as ConnectionConsumer
-
-
Field Summary
Fields Modifier and Type Field Description static intTYPE_GENERIC_SESSIONstatic intTYPE_QUEUE_SESSIONstatic intTYPE_TOPIC_SESSION
-
Constructor Summary
Constructors Modifier Constructor Description protectedActiveMQSession(ConnectionFactoryOptions options, ActiveMQConnection connection, boolean transacted, boolean xa, int ackMode, boolean cacheDestination, boolean enable1xPrefixes, ClientSession session, int sessionType)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidackAllConsumers()voidclose()voidcommit()javax.jms.QueueBrowsercreateBrowser(javax.jms.Queue queue)javax.jms.QueueBrowsercreateBrowser(javax.jms.Queue queue, java.lang.String filterString)javax.jms.BytesMessagecreateBytesMessage()javax.jms.MessageConsumercreateConsumer(javax.jms.Destination destination)javax.jms.MessageConsumercreateConsumer(javax.jms.Destination destination, java.lang.String messageSelector)javax.jms.MessageConsumercreateConsumer(javax.jms.Destination destination, java.lang.String messageSelector, boolean noLocal)javax.jms.MessageConsumercreateDurableConsumer(javax.jms.Topic topic, java.lang.String name)javax.jms.MessageConsumercreateDurableConsumer(javax.jms.Topic topic, java.lang.String name, java.lang.String messageSelector, boolean noLocal)javax.jms.TopicSubscribercreateDurableSubscriber(javax.jms.Topic topic, java.lang.String name)javax.jms.TopicSubscribercreateDurableSubscriber(javax.jms.Topic topic, java.lang.String name, java.lang.String messageSelector, boolean noLocal)javax.jms.MapMessagecreateMapMessage()javax.jms.MessagecreateMessage()javax.jms.ObjectMessagecreateObjectMessage()javax.jms.ObjectMessagecreateObjectMessage(java.io.Serializable object)javax.jms.MessageProducercreateProducer(javax.jms.Destination destination)javax.jms.TopicPublishercreatePublisher(javax.jms.Topic topic)javax.jms.QueuecreateQueue(java.lang.String queueName)javax.jms.QueueReceivercreateReceiver(javax.jms.Queue queue)javax.jms.QueueReceivercreateReceiver(javax.jms.Queue queue, java.lang.String messageSelector)javax.jms.QueueSendercreateSender(javax.jms.Queue queue)javax.jms.MessageConsumercreateSharedConsumer(javax.jms.Topic topic, java.lang.String sharedSubscriptionName)javax.jms.MessageConsumercreateSharedConsumer(javax.jms.Topic topic, java.lang.String name, java.lang.String messageSelector)Note: Needs to throw an exception if a subscriptionName is already in use by another topic, or if the messageSelector is different validate multiple subscriptions on the same session.javax.jms.MessageConsumercreateSharedDurableConsumer(javax.jms.Topic topic, java.lang.String name)javax.jms.MessageConsumercreateSharedDurableConsumer(javax.jms.Topic topic, java.lang.String name, java.lang.String messageSelector)javax.jms.StreamMessagecreateStreamMessage()javax.jms.TopicSubscribercreateSubscriber(javax.jms.Topic topic)javax.jms.TopicSubscribercreateSubscriber(javax.jms.Topic topic, java.lang.String messageSelector, boolean noLocal)javax.jms.TemporaryQueuecreateTemporaryQueue()javax.jms.TemporaryTopiccreateTemporaryTopic()javax.jms.TextMessagecreateTextMessage()javax.jms.TextMessagecreateTextMessage(java.lang.String text)javax.jms.TopiccreateTopic(java.lang.String topicName)voiddeleteTemporaryQueue(ActiveMQDestination tempQueue)voiddeleteTemporaryTopic(ActiveMQDestination tempTopic)intgetAcknowledgeMode()ActiveMQConnectiongetConnection()ClientSessiongetCoreSession()java.lang.StringgetDeserializationBlackList()java.lang.StringgetDeserializationWhiteList()javax.jms.MessageListenergetMessageListener()javax.jms.QueueSessiongetQueueSession()javax.jms.SessiongetSession()javax.jms.TopicSessiongetTopicSession()booleangetTransacted()javax.transaction.xa.XAResourcegetXAResource()protected javax.jms.QueueinternalCreateQueue(java.lang.String queueName)protected ActiveMQQueueinternalCreateQueueCompatibility(java.lang.String queueName)protected javax.jms.TopicinternalCreateTopic(java.lang.String topicName, boolean retry)booleanisEnable1xPrefixes()booleanisRecoverCalled()booleanisXA()voidrecover()voidremoveConsumer(ActiveMQMessageConsumer consumer)voidrollback()voidrun()voidsetMessageListener(javax.jms.MessageListener listener)voidsetRecoverCalled(boolean recoverCalled)voidstart()voidstop()java.lang.StringtoString()voidunsubscribe(java.lang.String name)
-
-
-
Field Detail
-
TYPE_GENERIC_SESSION
public static final int TYPE_GENERIC_SESSION
- See Also:
- Constant Field Values
-
TYPE_QUEUE_SESSION
public static final int TYPE_QUEUE_SESSION
- See Also:
- Constant Field Values
-
TYPE_TOPIC_SESSION
public static final int TYPE_TOPIC_SESSION
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ActiveMQSession
protected ActiveMQSession(ConnectionFactoryOptions options, ActiveMQConnection connection, boolean transacted, boolean xa, int ackMode, boolean cacheDestination, boolean enable1xPrefixes, ClientSession session, int sessionType)
-
-
Method Detail
-
createBytesMessage
public javax.jms.BytesMessage createBytesMessage() throws javax.jms.JMSException- Specified by:
createBytesMessagein interfacejavax.jms.Session- Throws:
javax.jms.JMSException
-
createMapMessage
public javax.jms.MapMessage createMapMessage() throws javax.jms.JMSException- Specified by:
createMapMessagein interfacejavax.jms.Session- Throws:
javax.jms.JMSException
-
createMessage
public javax.jms.Message createMessage() throws javax.jms.JMSException- Specified by:
createMessagein interfacejavax.jms.Session- Throws:
javax.jms.JMSException
-
createObjectMessage
public javax.jms.ObjectMessage createObjectMessage() throws javax.jms.JMSException- Specified by:
createObjectMessagein interfacejavax.jms.Session- Throws:
javax.jms.JMSException
-
createObjectMessage
public javax.jms.ObjectMessage createObjectMessage(java.io.Serializable object) throws javax.jms.JMSException- Specified by:
createObjectMessagein interfacejavax.jms.Session- Throws:
javax.jms.JMSException
-
createStreamMessage
public javax.jms.StreamMessage createStreamMessage() throws javax.jms.JMSException- Specified by:
createStreamMessagein interfacejavax.jms.Session- Throws:
javax.jms.JMSException
-
createTextMessage
public javax.jms.TextMessage createTextMessage() throws javax.jms.JMSException- Specified by:
createTextMessagein interfacejavax.jms.Session- Throws:
javax.jms.JMSException
-
createTextMessage
public javax.jms.TextMessage createTextMessage(java.lang.String text) throws javax.jms.JMSException- Specified by:
createTextMessagein interfacejavax.jms.Session- Throws:
javax.jms.JMSException
-
getTransacted
public boolean getTransacted() throws javax.jms.JMSException- Specified by:
getTransactedin interfacejavax.jms.Session- Throws:
javax.jms.JMSException
-
getAcknowledgeMode
public int getAcknowledgeMode() throws javax.jms.JMSException- Specified by:
getAcknowledgeModein interfacejavax.jms.Session- Throws:
javax.jms.JMSException
-
isXA
public boolean isXA()
-
commit
public void commit() throws javax.jms.JMSException- Specified by:
commitin interfacejavax.jms.Session- Throws:
javax.jms.JMSException
-
rollback
public void rollback() throws javax.jms.JMSException- Specified by:
rollbackin interfacejavax.jms.Session- Throws:
javax.jms.JMSException
-
close
public void close() throws javax.jms.JMSException- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejavax.jms.Session- Throws:
javax.jms.JMSException
-
recover
public void recover() throws javax.jms.JMSException- Specified by:
recoverin interfacejavax.jms.Session- Throws:
javax.jms.JMSException
-
getMessageListener
public javax.jms.MessageListener getMessageListener() throws javax.jms.JMSException- Specified by:
getMessageListenerin interfacejavax.jms.Session- Throws:
javax.jms.JMSException
-
setMessageListener
public void setMessageListener(javax.jms.MessageListener listener) throws javax.jms.JMSException- Specified by:
setMessageListenerin interfacejavax.jms.Session- Throws:
javax.jms.JMSException
-
run
public void run()
- Specified by:
runin interfacejava.lang.Runnable- Specified by:
runin interfacejavax.jms.Session
-
createProducer
public javax.jms.MessageProducer createProducer(javax.jms.Destination destination) throws javax.jms.JMSException- Specified by:
createProducerin interfacejavax.jms.Session- Throws:
javax.jms.JMSException
-
createConsumer
public javax.jms.MessageConsumer createConsumer(javax.jms.Destination destination) throws javax.jms.JMSException- Specified by:
createConsumerin interfacejavax.jms.Session- Throws:
javax.jms.JMSException
-
createConsumer
public javax.jms.MessageConsumer createConsumer(javax.jms.Destination destination, java.lang.String messageSelector) throws javax.jms.JMSException- Specified by:
createConsumerin interfacejavax.jms.Session- Throws:
javax.jms.JMSException
-
createConsumer
public javax.jms.MessageConsumer createConsumer(javax.jms.Destination destination, java.lang.String messageSelector, boolean noLocal) throws javax.jms.JMSException- Specified by:
createConsumerin interfacejavax.jms.Session- Throws:
javax.jms.JMSException
-
createQueue
public javax.jms.Queue createQueue(java.lang.String queueName) throws javax.jms.JMSException- Specified by:
createQueuein interfacejavax.jms.QueueSession- Specified by:
createQueuein interfacejavax.jms.Session- Throws:
javax.jms.JMSException
-
internalCreateQueue
protected javax.jms.Queue internalCreateQueue(java.lang.String queueName) throws org.apache.activemq.artemis.api.core.ActiveMQException, javax.jms.JMSException- Throws:
org.apache.activemq.artemis.api.core.ActiveMQExceptionjavax.jms.JMSException
-
internalCreateQueueCompatibility
protected ActiveMQQueue internalCreateQueueCompatibility(java.lang.String queueName) throws org.apache.activemq.artemis.api.core.ActiveMQException, javax.jms.JMSException
- Throws:
org.apache.activemq.artemis.api.core.ActiveMQExceptionjavax.jms.JMSException
-
createTopic
public javax.jms.Topic createTopic(java.lang.String topicName) throws javax.jms.JMSException- Specified by:
createTopicin interfacejavax.jms.Session- Specified by:
createTopicin interfacejavax.jms.TopicSession- Throws:
javax.jms.JMSException
-
internalCreateTopic
protected javax.jms.Topic internalCreateTopic(java.lang.String topicName, boolean retry) throws org.apache.activemq.artemis.api.core.ActiveMQException, javax.jms.JMSException- Throws:
org.apache.activemq.artemis.api.core.ActiveMQExceptionjavax.jms.JMSException
-
createDurableSubscriber
public javax.jms.TopicSubscriber createDurableSubscriber(javax.jms.Topic topic, java.lang.String name) throws javax.jms.JMSException- Specified by:
createDurableSubscriberin interfacejavax.jms.Session- Specified by:
createDurableSubscriberin interfacejavax.jms.TopicSession- Throws:
javax.jms.JMSException
-
createDurableSubscriber
public javax.jms.TopicSubscriber createDurableSubscriber(javax.jms.Topic topic, java.lang.String name, java.lang.String messageSelector, boolean noLocal) throws javax.jms.JMSException- Specified by:
createDurableSubscriberin interfacejavax.jms.Session- Specified by:
createDurableSubscriberin interfacejavax.jms.TopicSession- Throws:
javax.jms.JMSException
-
createSharedConsumer
public javax.jms.MessageConsumer createSharedConsumer(javax.jms.Topic topic, java.lang.String sharedSubscriptionName) throws javax.jms.JMSException- Specified by:
createSharedConsumerin interfacejavax.jms.Session- Throws:
javax.jms.JMSException
-
createSharedConsumer
public javax.jms.MessageConsumer createSharedConsumer(javax.jms.Topic topic, java.lang.String name, java.lang.String messageSelector) throws javax.jms.JMSExceptionNote: Needs to throw an exception if a subscriptionName is already in use by another topic, or if the messageSelector is different validate multiple subscriptions on the same session. validate multiple subscriptions on different sessions validate failure in one connection while another connection stills fine. Validate different filters in different possible scenarios- Specified by:
createSharedConsumerin interfacejavax.jms.Session- Parameters:
topic-name-messageSelector-- Returns:
- Throws:
javax.jms.JMSException
-
createDurableConsumer
public javax.jms.MessageConsumer createDurableConsumer(javax.jms.Topic topic, java.lang.String name) throws javax.jms.JMSException- Specified by:
createDurableConsumerin interfacejavax.jms.Session- Throws:
javax.jms.JMSException
-
createDurableConsumer
public javax.jms.MessageConsumer createDurableConsumer(javax.jms.Topic topic, java.lang.String name, java.lang.String messageSelector, boolean noLocal) throws javax.jms.JMSException- Specified by:
createDurableConsumerin interfacejavax.jms.Session- Throws:
javax.jms.JMSException
-
createSharedDurableConsumer
public javax.jms.MessageConsumer createSharedDurableConsumer(javax.jms.Topic topic, java.lang.String name) throws javax.jms.JMSException- Specified by:
createSharedDurableConsumerin interfacejavax.jms.Session- Throws:
javax.jms.JMSException
-
createSharedDurableConsumer
public javax.jms.MessageConsumer createSharedDurableConsumer(javax.jms.Topic topic, java.lang.String name, java.lang.String messageSelector) throws javax.jms.JMSException- Specified by:
createSharedDurableConsumerin interfacejavax.jms.Session- Throws:
javax.jms.JMSException
-
getDeserializationBlackList
public java.lang.String getDeserializationBlackList()
-
getDeserializationWhiteList
public java.lang.String getDeserializationWhiteList()
-
ackAllConsumers
public void ackAllConsumers() throws javax.jms.JMSException- Throws:
javax.jms.JMSException
-
createBrowser
public javax.jms.QueueBrowser createBrowser(javax.jms.Queue queue) throws javax.jms.JMSException- Specified by:
createBrowserin interfacejavax.jms.QueueSession- Specified by:
createBrowserin interfacejavax.jms.Session- Throws:
javax.jms.JMSException
-
createBrowser
public javax.jms.QueueBrowser createBrowser(javax.jms.Queue queue, java.lang.String filterString) throws javax.jms.JMSException- Specified by:
createBrowserin interfacejavax.jms.QueueSession- Specified by:
createBrowserin interfacejavax.jms.Session- Throws:
javax.jms.JMSException
-
createTemporaryQueue
public javax.jms.TemporaryQueue createTemporaryQueue() throws javax.jms.JMSException- Specified by:
createTemporaryQueuein interfacejavax.jms.QueueSession- Specified by:
createTemporaryQueuein interfacejavax.jms.Session- Throws:
javax.jms.JMSException
-
createTemporaryTopic
public javax.jms.TemporaryTopic createTemporaryTopic() throws javax.jms.JMSException- Specified by:
createTemporaryTopicin interfacejavax.jms.Session- Specified by:
createTemporaryTopicin interfacejavax.jms.TopicSession- Throws:
javax.jms.JMSException
-
unsubscribe
public void unsubscribe(java.lang.String name) throws javax.jms.JMSException- Specified by:
unsubscribein interfacejavax.jms.Session- Specified by:
unsubscribein interfacejavax.jms.TopicSession- Throws:
javax.jms.JMSException
-
getSession
public javax.jms.Session getSession() throws javax.jms.JMSException- Throws:
javax.jms.JMSException
-
getXAResource
public javax.transaction.xa.XAResource getXAResource()
-
createReceiver
public javax.jms.QueueReceiver createReceiver(javax.jms.Queue queue, java.lang.String messageSelector) throws javax.jms.JMSException- Specified by:
createReceiverin interfacejavax.jms.QueueSession- Throws:
javax.jms.JMSException
-
createReceiver
public javax.jms.QueueReceiver createReceiver(javax.jms.Queue queue) throws javax.jms.JMSException- Specified by:
createReceiverin interfacejavax.jms.QueueSession- Throws:
javax.jms.JMSException
-
createSender
public javax.jms.QueueSender createSender(javax.jms.Queue queue) throws javax.jms.JMSException- Specified by:
createSenderin interfacejavax.jms.QueueSession- Throws:
javax.jms.JMSException
-
getQueueSession
public javax.jms.QueueSession getQueueSession() throws javax.jms.JMSException- Throws:
javax.jms.JMSException
-
createPublisher
public javax.jms.TopicPublisher createPublisher(javax.jms.Topic topic) throws javax.jms.JMSException- Specified by:
createPublisherin interfacejavax.jms.TopicSession- Throws:
javax.jms.JMSException
-
createSubscriber
public javax.jms.TopicSubscriber createSubscriber(javax.jms.Topic topic, java.lang.String messageSelector, boolean noLocal) throws javax.jms.JMSException- Specified by:
createSubscriberin interfacejavax.jms.TopicSession- Throws:
javax.jms.JMSException
-
createSubscriber
public javax.jms.TopicSubscriber createSubscriber(javax.jms.Topic topic) throws javax.jms.JMSException- Specified by:
createSubscriberin interfacejavax.jms.TopicSession- Throws:
javax.jms.JMSException
-
getTopicSession
public javax.jms.TopicSession getTopicSession() throws javax.jms.JMSException- Throws:
javax.jms.JMSException
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
getCoreSession
public ClientSession getCoreSession()
-
isRecoverCalled
public boolean isRecoverCalled()
-
setRecoverCalled
public void setRecoverCalled(boolean recoverCalled)
-
deleteTemporaryTopic
public void deleteTemporaryTopic(ActiveMQDestination tempTopic) throws javax.jms.JMSException
- Throws:
javax.jms.JMSException
-
deleteTemporaryQueue
public void deleteTemporaryQueue(ActiveMQDestination tempQueue) throws javax.jms.JMSException
- Throws:
javax.jms.JMSException
-
start
public void start() throws javax.jms.JMSException- Throws:
javax.jms.JMSException
-
stop
public void stop() throws javax.jms.JMSException- Throws:
javax.jms.JMSException
-
removeConsumer
public void removeConsumer(ActiveMQMessageConsumer consumer)
-
isEnable1xPrefixes
public boolean isEnable1xPrefixes()
-
getConnection
public ActiveMQConnection getConnection()
-
-