public class SQSSession extends Object implements javax.jms.Session, javax.jms.QueueSession
Not safe for concurrent use.
This session object does not support:
| Modifier and Type | Field and Description |
|---|---|
static int |
UNORDERED_ACKNOWLEDGE
Non standard acknowledge mode.
|
| Modifier and Type | Method and Description |
|---|---|
void |
checkClosed()
Check if session is closed.
|
void |
checkClosing()
Check if session is closed or closing.
|
void |
close()
Closes the session.
|
void |
commit()
This method is not supported.
|
javax.jms.QueueBrowser |
createBrowser(javax.jms.Queue queue)
This method is not supported.
|
javax.jms.QueueBrowser |
createBrowser(javax.jms.Queue queue,
String messageSelector)
This method is not supported.
|
javax.jms.BytesMessage |
createBytesMessage()
Creates a
BytesMessage. |
javax.jms.MessageConsumer |
createConsumer(javax.jms.Destination destination)
Creates a
MessageConsumer for the specified destination. |
javax.jms.MessageConsumer |
createConsumer(javax.jms.Destination destination,
String messageSelector)
Creates a
MessageConsumer for the specified destination. |
javax.jms.MessageConsumer |
createConsumer(javax.jms.Destination destination,
String messageSelector,
boolean NoLocal)
Creates a
MessageConsumer for the specified destination. |
javax.jms.TopicSubscriber |
createDurableSubscriber(javax.jms.Topic topic,
String name)
This method is not supported.
|
javax.jms.TopicSubscriber |
createDurableSubscriber(javax.jms.Topic topic,
String name,
String messageSelector,
boolean noLocal)
This method is not supported.
|
javax.jms.MapMessage |
createMapMessage()
This method is not supported.
|
javax.jms.Message |
createMessage()
According to JMS specification, a message can be sent with only headers
without any payload, SQS does not support messages with empty payload.
|
javax.jms.ObjectMessage |
createObjectMessage()
Creates a
ObjectMessage. |
javax.jms.ObjectMessage |
createObjectMessage(Serializable object)
Creates an initialized
ObjectMessage. |
javax.jms.MessageProducer |
createProducer(javax.jms.Destination destination)
Creates a
MessageProducer for the specified destination. |
javax.jms.Queue |
createQueue(String queueName)
This does not create SQS Queue.
|
javax.jms.Queue |
createQueue(String queueName,
String ownerAccountId)
This does not create SQS Queue.
|
javax.jms.QueueReceiver |
createReceiver(javax.jms.Queue queue)
Creates a
QueueReceiver for the specified queue. |
javax.jms.QueueReceiver |
createReceiver(javax.jms.Queue queue,
String messageSelector)
Creates a
QueueReceiver for the specified queue. |
javax.jms.QueueSender |
createSender(javax.jms.Queue queue)
Creates a
QueueSender for the specified queue. |
javax.jms.StreamMessage |
createStreamMessage()
This method is not supported.
|
javax.jms.TemporaryQueue |
createTemporaryQueue()
This method is not supported.
|
javax.jms.TemporaryTopic |
createTemporaryTopic()
This method is not supported.
|
javax.jms.TextMessage |
createTextMessage()
Creates a
TextMessage. |
javax.jms.TextMessage |
createTextMessage(String text)
Creates an initialized
TextMessage. |
javax.jms.Topic |
createTopic(String topicName)
This method is not supported.
|
int |
getAcknowledgeMode()
Returns the acknowledge mode of the session.
|
javax.jms.MessageListener |
getMessageListener()
This method is not supported.
|
boolean |
getTransacted()
SQS does not support transacted.
|
void |
recover()
Negative acknowledges all the messages on the session that is delivered
but not acknowledged.
|
void |
rollback()
This method is not supported.
|
void |
run() |
void |
setMessageListener(javax.jms.MessageListener listener)
This method is not supported.
|
void |
unsubscribe(String name)
This method is not supported.
|
public static final int UNORDERED_ACKNOWLEDGE
public javax.jms.QueueReceiver createReceiver(javax.jms.Queue queue)
throws javax.jms.JMSException
QueueReceiver for the specified queue.createReceiver in interface javax.jms.QueueSessionqueue - a queue receiverjavax.jms.JMSException - If session is closedpublic javax.jms.QueueReceiver createReceiver(javax.jms.Queue queue,
String messageSelector)
throws javax.jms.JMSException
QueueReceiver for the specified queue. Does not
support messageSelector. It will drop anything in messageSelector.createReceiver in interface javax.jms.QueueSessionqueue - a queue destinationmessageSelector - javax.jms.JMSException - If session is closedpublic javax.jms.QueueSender createSender(javax.jms.Queue queue)
throws javax.jms.JMSException
QueueSender for the specified queue.createSender in interface javax.jms.QueueSessionqueue - a queue destinationjavax.jms.JMSException - If session is closedpublic javax.jms.BytesMessage createBytesMessage()
throws javax.jms.JMSException
BytesMessage.createBytesMessage in interface javax.jms.SessionBytesMessagejavax.jms.JMSException - If session is closed or internal errorpublic javax.jms.Message createMessage()
throws javax.jms.JMSException
createMessage in interface javax.jms.Sessionjavax.jms.JMSExceptionpublic javax.jms.ObjectMessage createObjectMessage()
throws javax.jms.JMSException
ObjectMessage.createObjectMessage in interface javax.jms.SessionObjectMessagejavax.jms.JMSException - If session is closed or internal errorpublic javax.jms.ObjectMessage createObjectMessage(Serializable object) throws javax.jms.JMSException
ObjectMessage.createObjectMessage in interface javax.jms.Sessionobject - The initialized ObjectMessageObjectMessagejavax.jms.JMSException - If session is closed or internal errorpublic javax.jms.TextMessage createTextMessage()
throws javax.jms.JMSException
TextMessage.createTextMessage in interface javax.jms.SessionTextMessagejavax.jms.JMSException - If session is closed or internal errorpublic javax.jms.TextMessage createTextMessage(String text) throws javax.jms.JMSException
TextMessage.createTextMessage in interface javax.jms.Sessiontext - The initialized TextMessageTextMessagejavax.jms.JMSException - If session is closed or internal errorpublic int getAcknowledgeMode()
throws javax.jms.JMSException
getAcknowledgeMode in interface javax.jms.Sessionjavax.jms.JMSExceptionpublic void close()
throws javax.jms.JMSException
This will not return until all the message consumers and producers close internally, which blocks until receives and/or message listeners in progress have completed. A blocked message consumer receive call returns null when this session is closed.
Since consumer prefetch threads use SQS long-poll feature with 20 seconds timeout, closing each consumer prefetch thread can take up to 20 seconds, which in-turn will impact the time on session close.
This method is safe for concurrent use.
A message listener must not attempt to close its own session; otherwise throws a IllegalStateException.
Invoking any other session method on a closed session must throw a
IllegalStateException.
close in interface javax.jms.Sessionjavax.jms.IllegalStateException - If called by a message listener on its own
Session.javax.jms.JMSException - On internal error.public void recover()
throws javax.jms.JMSException
recover in interface javax.jms.Sessionjavax.jms.JMSException - If session is closed or on internal error.public void run()
public javax.jms.MessageProducer createProducer(javax.jms.Destination destination)
throws javax.jms.JMSException
MessageProducer for the specified destination.
Only queue destinations are supported at this time.createProducer in interface javax.jms.Sessiondestination - a queue destinationjavax.jms.JMSException - If session is closed or queue destination is not usedpublic javax.jms.MessageConsumer createConsumer(javax.jms.Destination destination)
throws javax.jms.JMSException
MessageConsumer for the specified destination.
Only queue destinations are supported at this time.createConsumer in interface javax.jms.Sessiondestination - a queue destinationjavax.jms.JMSException - If session is closed or queue destination is not usedpublic javax.jms.MessageConsumer createConsumer(javax.jms.Destination destination,
String messageSelector)
throws javax.jms.JMSException
MessageConsumer for the specified destination.
Only queue destinations are supported at this time.
It will ignore any argument in messageSelector.createConsumer in interface javax.jms.Sessiondestination - a queue destinationmessageSelector - javax.jms.JMSException - If session is closed or queue destination is not usedpublic javax.jms.MessageConsumer createConsumer(javax.jms.Destination destination,
String messageSelector,
boolean NoLocal)
throws javax.jms.JMSException
MessageConsumer for the specified destination.
Only queue destinations are supported at this time. It will ignore any
argument in messageSelector and NoLocal.createConsumer in interface javax.jms.Sessiondestination - a queue destinationmessageSelector - NoLocal - javax.jms.JMSException - If session is closed or queue destination is not usedpublic javax.jms.Queue createQueue(String queueName) throws javax.jms.JMSException
createQueue in interface javax.jms.QueueSessioncreateQueue in interface javax.jms.SessionqueueName - javax.jms.JMSException - If session is closed or invalid queue is providedpublic javax.jms.Queue createQueue(String queueName, String ownerAccountId) throws javax.jms.JMSException
queueName - ownerAccountId - the account id, which originally created the queue on SQSjavax.jms.JMSException - If session is closed or invalid queue is providedpublic boolean getTransacted()
throws javax.jms.JMSException
getTransacted 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 unsubscribe(String name) throws javax.jms.JMSException
unsubscribe in interface javax.jms.Sessionjavax.jms.JMSExceptionpublic javax.jms.Topic createTopic(String topicName) throws javax.jms.JMSException
createTopic in interface javax.jms.Sessionjavax.jms.JMSExceptionpublic javax.jms.TopicSubscriber createDurableSubscriber(javax.jms.Topic topic,
String name)
throws javax.jms.JMSException
createDurableSubscriber in interface javax.jms.Sessionjavax.jms.JMSExceptionpublic javax.jms.TopicSubscriber createDurableSubscriber(javax.jms.Topic topic,
String name,
String messageSelector,
boolean noLocal)
throws javax.jms.JMSException
createDurableSubscriber in interface javax.jms.Sessionjavax.jms.JMSExceptionpublic javax.jms.QueueBrowser createBrowser(javax.jms.Queue queue)
throws javax.jms.JMSException
createBrowser in interface javax.jms.QueueSessioncreateBrowser in interface javax.jms.Sessionjavax.jms.JMSExceptionpublic javax.jms.QueueBrowser createBrowser(javax.jms.Queue queue,
String messageSelector)
throws javax.jms.JMSException
createBrowser in interface javax.jms.QueueSessioncreateBrowser in interface javax.jms.Sessionjavax.jms.JMSExceptionpublic javax.jms.TemporaryQueue createTemporaryQueue()
throws javax.jms.JMSException
createTemporaryQueue in interface javax.jms.QueueSessioncreateTemporaryQueue in interface javax.jms.Sessionjavax.jms.JMSExceptionpublic javax.jms.TemporaryTopic createTemporaryTopic()
throws javax.jms.JMSException
createTemporaryTopic 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 javax.jms.StreamMessage createStreamMessage()
throws javax.jms.JMSException
createStreamMessage in interface javax.jms.Sessionjavax.jms.JMSExceptionpublic javax.jms.MapMessage createMapMessage()
throws javax.jms.JMSException
createMapMessage in interface javax.jms.Sessionjavax.jms.JMSExceptionpublic void checkClosed()
throws javax.jms.IllegalStateException
javax.jms.IllegalStateExceptionpublic void checkClosing()
throws javax.jms.IllegalStateException
javax.jms.IllegalStateExceptionCopyright © 2022. All rights reserved.