public class SQSSession
extends java.lang.Object
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.
|
QueueBrowser |
createBrowser(Queue queue)
This method is not supported.
|
QueueBrowser |
createBrowser(Queue queue,
java.lang.String messageSelector)
This method is not supported.
|
BytesMessage |
createBytesMessage()
Creates a
BytesMessage. |
MessageConsumer |
createConsumer(Destination destination)
Creates a
MessageConsumer for the specified destination. |
MessageConsumer |
createConsumer(Destination destination,
java.lang.String messageSelector)
Creates a
MessageConsumer for the specified destination. |
MessageConsumer |
createConsumer(Destination destination,
java.lang.String messageSelector,
boolean NoLocal)
Creates a
MessageConsumer for the specified destination. |
TopicSubscriber |
createDurableSubscriber(Topic topic,
java.lang.String name)
This method is not supported.
|
TopicSubscriber |
createDurableSubscriber(Topic topic,
java.lang.String name,
java.lang.String messageSelector,
boolean noLocal)
This method is not supported.
|
MapMessage |
createMapMessage()
This method is not supported.
|
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.
|
ObjectMessage |
createObjectMessage()
Creates a
ObjectMessage. |
ObjectMessage |
createObjectMessage(java.io.Serializable object)
Creates an initialized
ObjectMessage. |
MessageProducer |
createProducer(Destination destination)
Creates a
MessageProducer for the specified destination. |
Queue |
createQueue(java.lang.String queueName)
This does not create SQS Queue.
|
Queue |
createQueue(java.lang.String queueName,
java.lang.String ownerAccountId)
This does not create SQS Queue.
|
QueueReceiver |
createReceiver(Queue queue)
Creates a
QueueReceiver for the specified queue. |
QueueReceiver |
createReceiver(Queue queue,
java.lang.String messageSelector)
Creates a
QueueReceiver for the specified queue. |
QueueSender |
createSender(Queue queue)
Creates a
QueueSender for the specified queue. |
StreamMessage |
createStreamMessage()
This method is not supported.
|
TemporaryQueue |
createTemporaryQueue()
This method is not supported.
|
TemporaryTopic |
createTemporaryTopic()
This method is not supported.
|
TextMessage |
createTextMessage()
Creates a
TextMessage. |
TextMessage |
createTextMessage(java.lang.String text)
Creates an initialized
TextMessage. |
Topic |
createTopic(java.lang.String topicName)
This method is not supported.
|
int |
getAcknowledgeMode()
Returns the acknowledge mode of the session.
|
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(MessageListener listener)
This method is not supported.
|
void |
unsubscribe(java.lang.String name)
This method is not supported.
|
public static final int UNORDERED_ACKNOWLEDGE
public QueueReceiver createReceiver(Queue queue)
throws JMSException
QueueReceiver for the specified queue.queue - a queue receiverJMSException - If session is closedpublic QueueReceiver createReceiver(Queue queue,
java.lang.String messageSelector)
throws JMSException
QueueReceiver for the specified queue. Does not
support messageSelector. It will drop anything in messageSelector.queue - a queue destinationmessageSelector - JMSException - If session is closedpublic QueueSender createSender(Queue queue)
throws JMSException
QueueSender for the specified queue.queue - a queue destinationJMSException - If session is closedpublic BytesMessage createBytesMessage()
throws JMSException
BytesMessage.BytesMessageJMSException - If session is closed or internal errorpublic Message createMessage()
throws JMSException
JMSExceptionpublic ObjectMessage createObjectMessage()
throws JMSException
ObjectMessage.ObjectMessageJMSException - If session is closed or internal errorpublic ObjectMessage createObjectMessage(java.io.Serializable object)
throws JMSException
ObjectMessage.object - The initialized ObjectMessageObjectMessageJMSException - If session is closed or internal errorpublic TextMessage createTextMessage()
throws JMSException
TextMessage.TextMessageJMSException - If session is closed or internal errorpublic TextMessage createTextMessage(java.lang.String text)
throws JMSException
TextMessage.text - The initialized TextMessageTextMessageJMSException - If session is closed or internal errorpublic int getAcknowledgeMode()
throws JMSException
JMSExceptionpublic void close()
throws 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.
java.lang.IllegalStateException - If called by a message listener on its own
Session.JMSException - On internal error.public void recover()
throws JMSException
JMSException - If session is closed or on internal error.public void run()
public MessageProducer createProducer(Destination destination)
throws JMSException
MessageProducer for the specified destination.
Only queue destinations are supported at this time.destination - a queue destinationJMSException - If session is closed or queue destination is not usedpublic MessageConsumer createConsumer(Destination destination)
throws JMSException
MessageConsumer for the specified destination.
Only queue destinations are supported at this time.destination - a queue destinationJMSException - If session is closed or queue destination is not usedpublic MessageConsumer createConsumer(Destination destination,
java.lang.String messageSelector)
throws JMSException
MessageConsumer for the specified destination.
Only queue destinations are supported at this time.
It will ignore any argument in messageSelector.destination - a queue destinationmessageSelector - JMSException - If session is closed or queue destination is not usedpublic MessageConsumer createConsumer(Destination destination,
java.lang.String messageSelector,
boolean NoLocal)
throws JMSException
MessageConsumer for the specified destination.
Only queue destinations are supported at this time. It will ignore any
argument in messageSelector and NoLocal.destination - a queue destinationmessageSelector - NoLocal - JMSException - If session is closed or queue destination is not usedpublic Queue createQueue(java.lang.String queueName)
throws JMSException
queueName - JMSException - If session is closed or invalid queue is providedpublic Queue createQueue(java.lang.String queueName,
java.lang.String ownerAccountId)
throws JMSException
queueName - ownerAccountId - the account id, which originally created the queue on SQSJMSException - If session is closed or invalid queue is providedpublic boolean getTransacted()
throws JMSException
JMSExceptionpublic void commit()
throws JMSException
JMSExceptionpublic void rollback()
throws JMSException
JMSExceptionpublic void unsubscribe(java.lang.String name)
throws JMSException
JMSExceptionpublic Topic createTopic(java.lang.String topicName)
throws JMSException
JMSExceptionpublic TopicSubscriber createDurableSubscriber(Topic topic,
java.lang.String name)
throws JMSException
JMSExceptionpublic TopicSubscriber createDurableSubscriber(Topic topic,
java.lang.String name,
java.lang.String messageSelector,
boolean noLocal)
throws JMSException
JMSExceptionpublic QueueBrowser createBrowser(Queue queue)
throws JMSException
JMSExceptionpublic QueueBrowser createBrowser(Queue queue,
java.lang.String messageSelector)
throws JMSException
JMSExceptionpublic TemporaryQueue createTemporaryQueue()
throws JMSException
JMSExceptionpublic TemporaryTopic createTemporaryTopic()
throws JMSException
JMSExceptionpublic MessageListener getMessageListener()
throws JMSException
JMSExceptionpublic void setMessageListener(MessageListener listener)
throws JMSException
JMSExceptionpublic StreamMessage createStreamMessage()
throws JMSException
JMSExceptionpublic MapMessage createMapMessage()
throws JMSException
JMSExceptionpublic void checkClosed()
throws java.lang.IllegalStateException
java.lang.IllegalStateExceptionpublic void checkClosing()
throws java.lang.IllegalStateException
java.lang.IllegalStateException