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.MessageConsumer |
createDurableConsumer(javax.jms.Topic topic,
String name) |
javax.jms.MessageConsumer |
createDurableConsumer(javax.jms.Topic topic,
String name,
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.MessageConsumer |
createSharedConsumer(javax.jms.Topic topic,
String name) |
javax.jms.MessageConsumer |
createSharedConsumer(javax.jms.Topic topic,
String name,
String selector) |
javax.jms.MessageConsumer |
createSharedDurableConsumer(javax.jms.Topic topic,
String name) |
javax.jms.MessageConsumer |
createSharedDurableConsumer(javax.jms.Topic topic,
String name,
String selector) |
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() |
JmsDeserializationPolicy |
getDeserializationPolicy() |
JmsMessageIDPolicy |
getMessageIDPolicy() |
javax.jms.MessageListener |
getMessageListener() |
protected JmsConsumerId |
getNextConsumerId() |
protected JmsProducerId |
getNextProducerId() |
JmsPrefetchPolicy |
getPrefetchPolicy() |
JmsPresettlePolicy |
getPresettlePolicy() |
JmsRedeliveryPolicy |
getRedeliveryPolicy() |
protected JmsSessionId |
getSessionId() |
protected JmsSessionInfo |
getSessionInfo() |
protected int |
getSessionMode() |
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.
|
boolean |
isIndividualAcknowledge()
Checks whether the session used individual acknowledgment mode.
|
boolean |
isNoAcknowledge()
Checks whether the session uses presettlement for all consumers.
|
protected boolean |
isStarted() |
boolean |
isTransacted()
Checks whether the session uses transactions.
|
protected JmsMessageConsumer |
lookup(JmsConsumerId consumerId) |
protected JmsMessageProducer |
lookup(JmsProducerId producerId) |
protected void |
onCompletedMessageSend(JmsOutboundMessageDispatch envelope) |
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) |
protected void |
onFailedMessageSend(JmsOutboundMessageDispatch envelope,
Throwable cause) |
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,
long deliveryDelay,
javax.jms.CompletionListener listener) |
void |
setMessageListener(javax.jms.MessageListener listener) |
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(Throwable 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.JMSExceptionpublic int getAcknowledgeMode()
throws javax.jms.JMSException
getAcknowledgeMode in interface javax.jms.Sessionjavax.jms.JMSExceptionpublic boolean getTransacted()
throws javax.jms.JMSException
getTransacted in interface javax.jms.Sessionjavax.jms.JMSExceptionpublic javax.jms.MessageListener getMessageListener()
throws javax.jms.JMSException
getMessageListener in interface javax.jms.Sessionjavax.jms.JMSExceptionpublic void setMessageListener(javax.jms.MessageListener listener)
throws javax.jms.JMSException
setMessageListener in interface javax.jms.Sessionjavax.jms.JMSExceptionpublic void recover()
throws javax.jms.JMSException
recover in interface javax.jms.Sessionjavax.jms.JMSExceptionpublic void commit()
throws javax.jms.JMSException
commit in interface javax.jms.Sessionjavax.jms.JMSExceptionpublic void rollback()
throws javax.jms.JMSException
rollback in interface javax.jms.Sessionjavax.jms.JMSExceptionpublic void close()
throws javax.jms.JMSException
close in interface AutoCloseableclose in interface javax.jms.Sessionjavax.jms.JMSExceptionprotected 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(Throwable cause) throws javax.jms.JMSException
javax.jms.JMSExceptionpublic javax.jms.MessageConsumer createConsumer(javax.jms.Destination destination)
throws javax.jms.JMSException
createConsumer in interface javax.jms.Sessionjavax.jms.JMSExceptionSession.createConsumer(javax.jms.Destination)public javax.jms.MessageConsumer createConsumer(javax.jms.Destination destination,
String messageSelector)
throws javax.jms.JMSException
createConsumer in interface javax.jms.Sessionjavax.jms.JMSExceptionSession.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.Sessionjavax.jms.JMSExceptionSession.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.QueueSessionjavax.jms.JMSExceptionQueueSession.createReceiver(javax.jms.Queue)public javax.jms.QueueReceiver createReceiver(javax.jms.Queue queue,
String messageSelector)
throws javax.jms.JMSException
createReceiver in interface javax.jms.QueueSessionjavax.jms.JMSExceptionQueueSession.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.QueueSessioncreateBrowser in interface javax.jms.Sessionjavax.jms.JMSExceptionSession.createBrowser(javax.jms.Queue)public javax.jms.QueueBrowser createBrowser(javax.jms.Queue destination,
String messageSelector)
throws javax.jms.JMSException
createBrowser in interface javax.jms.QueueSessioncreateBrowser in interface javax.jms.Sessionjavax.jms.JMSExceptionSession.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.TopicSessionjavax.jms.JMSExceptionTopicSession.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.TopicSessionjavax.jms.JMSExceptionTopicSession.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.SessioncreateDurableSubscriber in interface javax.jms.TopicSessionjavax.jms.JMSExceptionSession.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.SessioncreateDurableSubscriber in interface javax.jms.TopicSessionjavax.jms.JMSExceptionSession.createDurableSubscriber(javax.jms.Topic, java.lang.String, java.lang.String, boolean)public javax.jms.MessageConsumer createDurableConsumer(javax.jms.Topic topic,
String name)
throws javax.jms.JMSException
createDurableConsumer in interface javax.jms.Sessionjavax.jms.JMSExceptionSession.createDurableConsumer(javax.jms.Topic, java.lang.String)public javax.jms.MessageConsumer createDurableConsumer(javax.jms.Topic topic,
String name,
String messageSelector,
boolean noLocal)
throws javax.jms.JMSException
createDurableConsumer in interface javax.jms.Sessionjavax.jms.JMSExceptionSession.createDurableConsumer(javax.jms.Topic, java.lang.String, java.lang.String, boolean)protected void checkClientIDWasSetExplicitly()
throws javax.jms.IllegalStateException
javax.jms.IllegalStateExceptionpublic void unsubscribe(String name) throws javax.jms.JMSException
unsubscribe in interface javax.jms.Sessionunsubscribe in interface javax.jms.TopicSessionjavax.jms.JMSExceptionSession.unsubscribe(java.lang.String)public javax.jms.MessageConsumer createSharedConsumer(javax.jms.Topic topic,
String name)
throws javax.jms.JMSException
createSharedConsumer in interface javax.jms.Sessionjavax.jms.JMSExceptionSession.createSharedConsumer(javax.jms.Topic, java.lang.String)public javax.jms.MessageConsumer createSharedConsumer(javax.jms.Topic topic,
String name,
String selector)
throws javax.jms.JMSException
createSharedConsumer in interface javax.jms.Sessionjavax.jms.JMSExceptionSession.createSharedConsumer(javax.jms.Topic, java.lang.String, java.lang.String)public javax.jms.MessageConsumer createSharedDurableConsumer(javax.jms.Topic topic,
String name)
throws javax.jms.JMSException
createSharedDurableConsumer in interface javax.jms.Sessionjavax.jms.JMSExceptionSession.createSharedDurableConsumer(javax.jms.Topic, java.lang.String)public javax.jms.MessageConsumer createSharedDurableConsumer(javax.jms.Topic topic,
String name,
String selector)
throws javax.jms.JMSException
createSharedDurableConsumer in interface javax.jms.Sessionjavax.jms.JMSExceptionSession.createSharedDurableConsumer(javax.jms.Topic, java.lang.String, java.lang.String)public javax.jms.MessageProducer createProducer(javax.jms.Destination destination)
throws javax.jms.JMSException
createProducer in interface javax.jms.Sessionjavax.jms.JMSExceptionSession.createProducer(javax.jms.Destination)public javax.jms.QueueSender createSender(javax.jms.Queue queue)
throws javax.jms.JMSException
createSender in interface javax.jms.QueueSessionjavax.jms.JMSExceptionQueueSession.createSender(javax.jms.Queue)public javax.jms.TopicPublisher createPublisher(javax.jms.Topic topic)
throws javax.jms.JMSException
createPublisher in interface javax.jms.TopicSessionjavax.jms.JMSExceptionTopicSession.createPublisher(javax.jms.Topic)public javax.jms.BytesMessage createBytesMessage()
throws javax.jms.JMSException
createBytesMessage in interface javax.jms.Sessionjavax.jms.JMSExceptionpublic javax.jms.MapMessage createMapMessage()
throws javax.jms.JMSException
createMapMessage in interface javax.jms.Sessionjavax.jms.JMSExceptionpublic javax.jms.Message createMessage()
throws javax.jms.JMSException
createMessage in interface javax.jms.Sessionjavax.jms.JMSExceptionpublic javax.jms.ObjectMessage createObjectMessage()
throws javax.jms.JMSException
createObjectMessage in interface javax.jms.Sessionjavax.jms.JMSExceptionpublic javax.jms.ObjectMessage createObjectMessage(Serializable object) throws javax.jms.JMSException
createObjectMessage in interface javax.jms.Sessionjavax.jms.JMSExceptionpublic javax.jms.StreamMessage createStreamMessage()
throws javax.jms.JMSException
createStreamMessage in interface javax.jms.Sessionjavax.jms.JMSExceptionpublic javax.jms.TextMessage createTextMessage()
throws javax.jms.JMSException
createTextMessage in interface javax.jms.Sessionjavax.jms.JMSExceptionpublic javax.jms.TextMessage createTextMessage(String text) throws javax.jms.JMSException
createTextMessage in interface javax.jms.Sessionjavax.jms.JMSExceptionpublic javax.jms.Queue createQueue(String queueName) throws javax.jms.JMSException
createQueue in interface javax.jms.QueueSessioncreateQueue in interface javax.jms.Sessionjavax.jms.JMSExceptionSession.createQueue(java.lang.String)public javax.jms.Topic createTopic(String topicName) throws javax.jms.JMSException
createTopic in interface javax.jms.SessioncreateTopic in interface javax.jms.TopicSessionjavax.jms.JMSExceptionSession.createTopic(java.lang.String)public javax.jms.TemporaryQueue createTemporaryQueue()
throws javax.jms.JMSException
createTemporaryQueue in interface javax.jms.QueueSessioncreateTemporaryQueue in interface javax.jms.Sessionjavax.jms.JMSExceptionSession.createTemporaryQueue()public javax.jms.TemporaryTopic createTemporaryTopic()
throws javax.jms.JMSException
createTemporaryTopic in interface javax.jms.SessioncreateTemporaryTopic in interface javax.jms.TopicSessionjavax.jms.JMSExceptionSession.createTemporaryTopic()public void run()
protected void add(JmsMessageConsumer consumer)
protected void remove(JmsMessageConsumer consumer)
protected JmsMessageConsumer lookup(JmsConsumerId consumerId)
protected void add(JmsMessageProducer producer)
protected void remove(JmsMessageProducer producer)
protected JmsMessageProducer lookup(JmsProducerId producerId)
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, long deliveryDelay, javax.jms.CompletionListener listener) throws javax.jms.JMSException
javax.jms.JMSExceptionpublic boolean isClosed()
public boolean isTransacted()
public boolean isClientAcknowledge()
public boolean isAutoAcknowledge()
public boolean isDupsOkAcknowledge()
public boolean isNoAcknowledge()
public boolean isIndividualAcknowledge()
protected void checkClosed()
throws javax.jms.IllegalStateException
javax.jms.IllegalStateExceptionpublic static void checkDestination(javax.jms.Destination dest)
throws javax.jms.InvalidDestinationException
javax.jms.InvalidDestinationExceptionprotected void start()
throws javax.jms.JMSException
javax.jms.JMSExceptionprotected void stop()
throws javax.jms.JMSException
javax.jms.JMSExceptionprotected boolean isStarted()
public JmsConnection getConnection()
protected JmsSessionInfo getSessionInfo()
protected JmsSessionId getSessionId()
protected int getSessionMode()
protected JmsConsumerId getNextConsumerId()
protected JmsProducerId getNextProducerId()
public JmsMessageIDPolicy getMessageIDPolicy()
public JmsPrefetchPolicy getPrefetchPolicy()
public JmsPresettlePolicy getPresettlePolicy()
public JmsRedeliveryPolicy getRedeliveryPolicy()
public JmsDeserializationPolicy getDeserializationPolicy()
public void setTransactionContext(JmsTransactionContext transactionContext)
transactionContext - provides the means to control a JMS transaction.public JmsTransactionContext getTransactionContext()
public void onInboundMessage(JmsInboundMessageDispatch envelope)
JmsMessageDispatcheronInboundMessage in interface JmsMessageDispatcherenvelope - the incoming message dispatch information.protected void onCompletedMessageSend(JmsOutboundMessageDispatch envelope)
protected void onFailedMessageSend(JmsOutboundMessageDispatch envelope, Throwable cause)
protected void onConnectionInterrupted()
protected void onConnectionRecovery(Provider provider) throws Exception
Exceptionprotected void onConnectionRecovered(Provider provider) throws Exception
Exceptionprotected void onConnectionRestored()
Copyright © 2013–2019 The Apache Software Foundation. All rights reserved.