public class JmsSession extends Object implements AutoCloseable, javax.jms.Session, javax.jms.QueueSession, javax.jms.TopicSession, JmsMessageDispatcher
Modifier | Constructor and Description |
---|---|
protected |
JmsSession(JmsConnection connection,
JmsSessionId sessionId,
int acknowledgementMode) |
Modifier and Type | Method and Description |
---|---|
protected void |
add(JmsMessageConsumer consumer) |
protected void |
add(JmsMessageProducer producer) |
protected void |
checkClientIDWasSetExplicitly() |
protected void |
checkClosed() |
static void |
checkDestination(javax.jms.Destination dest) |
void |
close() |
void |
commit() |
javax.jms.QueueBrowser |
createBrowser(javax.jms.Queue destination) |
javax.jms.QueueBrowser |
createBrowser(javax.jms.Queue destination,
String messageSelector) |
javax.jms.BytesMessage |
createBytesMessage() |
javax.jms.MessageConsumer |
createConsumer(javax.jms.Destination destination) |
javax.jms.MessageConsumer |
createConsumer(javax.jms.Destination destination,
String messageSelector) |
javax.jms.MessageConsumer |
createConsumer(javax.jms.Destination destination,
String messageSelector,
boolean noLocal) |
javax.jms.TopicSubscriber |
createDurableSubscriber(javax.jms.Topic topic,
String name) |
javax.jms.TopicSubscriber |
createDurableSubscriber(javax.jms.Topic topic,
String name,
String messageSelector,
boolean noLocal) |
javax.jms.MapMessage |
createMapMessage() |
javax.jms.Message |
createMessage() |
javax.jms.ObjectMessage |
createObjectMessage() |
javax.jms.ObjectMessage |
createObjectMessage(Serializable object) |
javax.jms.MessageProducer |
createProducer(javax.jms.Destination destination) |
javax.jms.TopicPublisher |
createPublisher(javax.jms.Topic topic) |
javax.jms.Queue |
createQueue(String queueName) |
javax.jms.QueueReceiver |
createReceiver(javax.jms.Queue queue) |
javax.jms.QueueReceiver |
createReceiver(javax.jms.Queue queue,
String messageSelector) |
javax.jms.QueueSender |
createSender(javax.jms.Queue queue) |
javax.jms.StreamMessage |
createStreamMessage() |
javax.jms.TopicSubscriber |
createSubscriber(javax.jms.Topic topic) |
javax.jms.TopicSubscriber |
createSubscriber(javax.jms.Topic topic,
String messageSelector,
boolean noLocal) |
javax.jms.TemporaryQueue |
createTemporaryQueue() |
javax.jms.TemporaryTopic |
createTemporaryTopic() |
javax.jms.TextMessage |
createTextMessage() |
javax.jms.TextMessage |
createTextMessage(String text) |
javax.jms.Topic |
createTopic(String topicName) |
protected void |
doClose()
Shutdown the Session and release all resources.
|
int |
getAcknowledgeMode() |
JmsConnection |
getConnection() |
javax.jms.MessageListener |
getMessageListener() |
protected JmsConsumerId |
getNextConsumerId() |
protected JmsProducerId |
getNextProducerId() |
JmsPrefetchPolicy |
getPrefetchPolicy() |
protected JmsSessionId |
getSessionId() |
protected JmsSessionInfo |
getSessionInfo() |
boolean |
getTransacted() |
JmsTransactionContext |
getTransactionContext()
Returns the transaction context of the session.
|
boolean |
isAutoAcknowledge()
Checks whether the session used auto acknowledgment.
|
boolean |
isClientAcknowledge()
Checks whether the session used client acknowledgment.
|
boolean |
isClosed() |
boolean |
isDupsOkAcknowledge()
Checks whether the session used dup ok acknowledgment.
|
protected boolean |
isStarted() |
boolean |
isTransacted()
Checks whether the session uses transactions.
|
protected void |
onConnectionInterrupted() |
protected void |
onConnectionRecovered(Provider provider) |
protected void |
onConnectionRecovery(Provider provider) |
protected void |
onConnectionRestored() |
protected void |
onException(Exception ex) |
protected void |
onException(javax.jms.JMSException ex) |
void |
onInboundMessage(JmsInboundMessageDispatch envelope)
Called when a new Message delivery is in progress.
|
void |
recover() |
protected void |
remove(JmsMessageConsumer consumer) |
protected void |
remove(JmsMessageProducer producer) |
void |
rollback() |
void |
run() |
protected void |
send(JmsMessageProducer producer,
javax.jms.Destination dest,
javax.jms.Message msg,
int deliveryMode,
int priority,
long timeToLive,
boolean disableMsgId,
boolean disableTimestamp) |
void |
setMessageListener(javax.jms.MessageListener listener) |
void |
setPrefetchPolicy(JmsPrefetchPolicy prefetchPolicy) |
void |
setTransactionContext(JmsTransactionContext transactionContext)
Sets the transaction context of the session.
|
protected void |
shutdown()
This method should terminate all Session resources and prepare for disposal of the
Session.
|
protected void |
shutdown(Exception cause) |
protected void |
start() |
protected void |
stop() |
void |
unsubscribe(String name) |
protected JmsSession(JmsConnection connection, JmsSessionId sessionId, int acknowledgementMode) throws javax.jms.JMSException
javax.jms.JMSException
public int getAcknowledgeMode() throws javax.jms.JMSException
getAcknowledgeMode
in interface javax.jms.Session
javax.jms.JMSException
public boolean getTransacted() throws javax.jms.JMSException
getTransacted
in interface javax.jms.Session
javax.jms.JMSException
public javax.jms.MessageListener getMessageListener() throws javax.jms.JMSException
getMessageListener
in interface javax.jms.Session
javax.jms.JMSException
public void setMessageListener(javax.jms.MessageListener listener) throws javax.jms.JMSException
setMessageListener
in interface javax.jms.Session
javax.jms.JMSException
public void recover() throws javax.jms.JMSException
recover
in interface javax.jms.Session
javax.jms.JMSException
public void commit() throws javax.jms.JMSException
commit
in interface javax.jms.Session
javax.jms.JMSException
public void rollback() throws javax.jms.JMSException
rollback
in interface javax.jms.Session
javax.jms.JMSException
public void run()
public void close() throws javax.jms.JMSException
close
in interface AutoCloseable
close
in interface javax.jms.Session
javax.jms.JMSException
protected void doClose() throws javax.jms.JMSException
javax.jms.JMSException
- if an internal error occurs during the close operation.protected void shutdown() throws javax.jms.JMSException
javax.jms.JMSException
- if an error occurs while shutting down the session resources.protected void shutdown(Exception cause) throws javax.jms.JMSException
javax.jms.JMSException
public javax.jms.MessageConsumer createConsumer(javax.jms.Destination destination) throws javax.jms.JMSException
createConsumer
in interface javax.jms.Session
javax.jms.JMSException
Session.createConsumer(javax.jms.Destination)
public javax.jms.MessageConsumer createConsumer(javax.jms.Destination destination, String messageSelector) throws javax.jms.JMSException
createConsumer
in interface javax.jms.Session
javax.jms.JMSException
Session.createConsumer(javax.jms.Destination, java.lang.String)
public javax.jms.MessageConsumer createConsumer(javax.jms.Destination destination, String messageSelector, boolean noLocal) throws javax.jms.JMSException
createConsumer
in interface javax.jms.Session
javax.jms.JMSException
Session.createConsumer(javax.jms.Destination, java.lang.String, boolean)
public javax.jms.QueueReceiver createReceiver(javax.jms.Queue queue) throws javax.jms.JMSException
createReceiver
in interface javax.jms.QueueSession
javax.jms.JMSException
QueueSession.createReceiver(javax.jms.Queue)
public javax.jms.QueueReceiver createReceiver(javax.jms.Queue queue, String messageSelector) throws javax.jms.JMSException
createReceiver
in interface javax.jms.QueueSession
javax.jms.JMSException
QueueSession.createReceiver(javax.jms.Queue, java.lang.String)
public javax.jms.QueueBrowser createBrowser(javax.jms.Queue destination) throws javax.jms.JMSException
createBrowser
in interface javax.jms.QueueSession
createBrowser
in interface javax.jms.Session
javax.jms.JMSException
Session.createBrowser(javax.jms.Queue)
public javax.jms.QueueBrowser createBrowser(javax.jms.Queue destination, String messageSelector) throws javax.jms.JMSException
createBrowser
in interface javax.jms.QueueSession
createBrowser
in interface javax.jms.Session
javax.jms.JMSException
Session.createBrowser(javax.jms.Queue, java.lang.String)
public javax.jms.TopicSubscriber createSubscriber(javax.jms.Topic topic) throws javax.jms.JMSException
createSubscriber
in interface javax.jms.TopicSession
javax.jms.JMSException
TopicSession.createSubscriber(javax.jms.Topic)
public javax.jms.TopicSubscriber createSubscriber(javax.jms.Topic topic, String messageSelector, boolean noLocal) throws javax.jms.JMSException
createSubscriber
in interface javax.jms.TopicSession
javax.jms.JMSException
TopicSession.createSubscriber(javax.jms.Topic, java.lang.String, boolean)
public javax.jms.TopicSubscriber createDurableSubscriber(javax.jms.Topic topic, String name) throws javax.jms.JMSException
createDurableSubscriber
in interface javax.jms.Session
createDurableSubscriber
in interface javax.jms.TopicSession
javax.jms.JMSException
Session.createDurableSubscriber(javax.jms.Topic, java.lang.String)
public javax.jms.TopicSubscriber createDurableSubscriber(javax.jms.Topic topic, String name, String messageSelector, boolean noLocal) throws javax.jms.JMSException
createDurableSubscriber
in interface javax.jms.Session
createDurableSubscriber
in interface javax.jms.TopicSession
javax.jms.JMSException
Session.createDurableSubscriber(javax.jms.Topic, java.lang.String, java.lang.String, boolean)
protected void checkClientIDWasSetExplicitly() throws javax.jms.IllegalStateException
javax.jms.IllegalStateException
public void unsubscribe(String name) throws javax.jms.JMSException
unsubscribe
in interface javax.jms.Session
unsubscribe
in interface javax.jms.TopicSession
javax.jms.JMSException
Session.unsubscribe(java.lang.String)
public javax.jms.MessageProducer createProducer(javax.jms.Destination destination) throws javax.jms.JMSException
createProducer
in interface javax.jms.Session
javax.jms.JMSException
Session.createProducer(javax.jms.Destination)
public javax.jms.QueueSender createSender(javax.jms.Queue queue) throws javax.jms.JMSException
createSender
in interface javax.jms.QueueSession
javax.jms.JMSException
QueueSession.createSender(javax.jms.Queue)
public javax.jms.TopicPublisher createPublisher(javax.jms.Topic topic) throws javax.jms.JMSException
createPublisher
in interface javax.jms.TopicSession
javax.jms.JMSException
TopicSession.createPublisher(javax.jms.Topic)
public javax.jms.BytesMessage createBytesMessage() throws javax.jms.JMSException
createBytesMessage
in interface javax.jms.Session
javax.jms.JMSException
public javax.jms.MapMessage createMapMessage() throws javax.jms.JMSException
createMapMessage
in interface javax.jms.Session
javax.jms.JMSException
public javax.jms.Message createMessage() throws javax.jms.JMSException
createMessage
in interface javax.jms.Session
javax.jms.JMSException
public javax.jms.ObjectMessage createObjectMessage() throws javax.jms.JMSException
createObjectMessage
in interface javax.jms.Session
javax.jms.JMSException
public javax.jms.ObjectMessage createObjectMessage(Serializable object) throws javax.jms.JMSException
createObjectMessage
in interface javax.jms.Session
javax.jms.JMSException
public javax.jms.StreamMessage createStreamMessage() throws javax.jms.JMSException
createStreamMessage
in interface javax.jms.Session
javax.jms.JMSException
public javax.jms.TextMessage createTextMessage() throws javax.jms.JMSException
createTextMessage
in interface javax.jms.Session
javax.jms.JMSException
public javax.jms.TextMessage createTextMessage(String text) throws javax.jms.JMSException
createTextMessage
in interface javax.jms.Session
javax.jms.JMSException
public javax.jms.Queue createQueue(String queueName) throws javax.jms.JMSException
createQueue
in interface javax.jms.QueueSession
createQueue
in interface javax.jms.Session
javax.jms.JMSException
Session.createQueue(java.lang.String)
public javax.jms.Topic createTopic(String topicName) throws javax.jms.JMSException
createTopic
in interface javax.jms.Session
createTopic
in interface javax.jms.TopicSession
javax.jms.JMSException
Session.createTopic(java.lang.String)
public javax.jms.TemporaryQueue createTemporaryQueue() throws javax.jms.JMSException
createTemporaryQueue
in interface javax.jms.QueueSession
createTemporaryQueue
in interface javax.jms.Session
javax.jms.JMSException
Session.createTemporaryQueue()
public javax.jms.TemporaryTopic createTemporaryTopic() throws javax.jms.JMSException
createTemporaryTopic
in interface javax.jms.Session
createTemporaryTopic
in interface javax.jms.TopicSession
javax.jms.JMSException
Session.createTemporaryTopic()
protected void add(JmsMessageConsumer consumer) throws javax.jms.JMSException
javax.jms.JMSException
protected void remove(JmsMessageConsumer consumer) throws javax.jms.JMSException
javax.jms.JMSException
protected void add(JmsMessageProducer producer)
protected void remove(JmsMessageProducer producer)
protected void onException(Exception ex)
protected void onException(javax.jms.JMSException ex)
protected void send(JmsMessageProducer producer, javax.jms.Destination dest, javax.jms.Message msg, int deliveryMode, int priority, long timeToLive, boolean disableMsgId, boolean disableTimestamp) throws javax.jms.JMSException
javax.jms.JMSException
public boolean isClosed()
public boolean isTransacted()
public boolean isClientAcknowledge()
public boolean isAutoAcknowledge()
public boolean isDupsOkAcknowledge()
protected void checkClosed() throws javax.jms.IllegalStateException
javax.jms.IllegalStateException
public static void checkDestination(javax.jms.Destination dest) throws javax.jms.InvalidDestinationException
javax.jms.InvalidDestinationException
protected void start() throws javax.jms.JMSException
javax.jms.JMSException
protected void stop() throws javax.jms.JMSException
javax.jms.JMSException
protected boolean isStarted()
public JmsConnection getConnection()
protected JmsSessionInfo getSessionInfo()
protected JmsSessionId getSessionId()
protected JmsConsumerId getNextConsumerId()
protected JmsProducerId getNextProducerId()
public JmsPrefetchPolicy getPrefetchPolicy()
public void setPrefetchPolicy(JmsPrefetchPolicy prefetchPolicy)
public void onInboundMessage(JmsInboundMessageDispatch envelope)
JmsMessageDispatcher
onInboundMessage
in interface JmsMessageDispatcher
envelope
- the incoming message dispatch information.protected void onConnectionInterrupted()
protected void onConnectionRecovery(Provider provider) throws Exception
Exception
protected void onConnectionRecovered(Provider provider) throws Exception
Exception
protected void onConnectionRestored()
public void setTransactionContext(JmsTransactionContext transactionContext)
transactionContext
- provides the means to control a JMS transaction.public JmsTransactionContext getTransactionContext()
Copyright © 2013–2016 The Apache Software Foundation. All rights reserved.