|
Joram 5.3.1 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.objectweb.joram.client.jms.Session
public class Session
Implements the javax.jms.Session
interface.
A Session object is a single-threaded context for producing and consuming messages. A session serves several purposes:
Field Summary | |
---|---|
static org.objectweb.util.monolog.api.Logger |
logger
|
protected javax.jms.MessageListener |
messageListener
The message listener of the session, if any. |
Fields inherited from interface javax.jms.Session |
---|
AUTO_ACKNOWLEDGE, CLIENT_ACKNOWLEDGE, DUPS_OK_ACKNOWLEDGE, SESSION_TRANSACTED |
Method Summary | |
---|---|
protected void |
addConsumer(MessageConsumer mc)
Called here and by sub-classes. |
protected void |
addProducer(MessageProducer mp)
Called here and by sub-classes. |
protected void |
checkClosed()
Checks if the session is closed. |
void |
close()
Closes the session. |
void |
commit()
API method. |
javax.jms.QueueBrowser |
createBrowser(javax.jms.Queue queue)
Creates a QueueBrowser object to peek at the messages on the specified queue. |
javax.jms.QueueBrowser |
createBrowser(javax.jms.Queue queue,
java.lang.String selector)
Creates a QueueBrowser object to peek at the messages on the specified queue using a message selector. |
javax.jms.BytesMessage |
createBytesMessage()
Creates a BytesMessage object. |
javax.jms.MessageConsumer |
createConsumer(javax.jms.Destination dest)
Creates a MessageConsumer for the specified destination. |
javax.jms.MessageConsumer |
createConsumer(javax.jms.Destination dest,
java.lang.String selector)
Creates a MessageConsumer for the specified destination using a message selector. |
javax.jms.MessageConsumer |
createConsumer(javax.jms.Destination dest,
java.lang.String selector,
boolean noLocal)
Creates a MessageConsumer for the specified destination using a message selector. |
javax.jms.TopicSubscriber |
createDurableSubscriber(javax.jms.Topic topic,
java.lang.String name)
Creates or retrieves a durable subscription with the specified name. |
javax.jms.TopicSubscriber |
createDurableSubscriber(javax.jms.Topic topic,
java.lang.String name,
java.lang.String selector,
boolean noLocal)
Creates or retrieves a durable subscription with the specified name. |
javax.jms.MapMessage |
createMapMessage()
Creates a MapMessage object. |
javax.jms.Message |
createMessage()
Creates a Message object. |
javax.jms.ObjectMessage |
createObjectMessage()
Creates a ObjectMessage object. |
javax.jms.ObjectMessage |
createObjectMessage(java.io.Serializable obj)
Creates a ObjectMessage object. |
javax.jms.MessageProducer |
createProducer(javax.jms.Destination dest)
Creates a MessageProducer to send messages to the specified destination. |
javax.jms.Queue |
createQueue(java.lang.String queueName)
API method. |
javax.jms.StreamMessage |
createStreamMessage()
Creates a StreamMessage object. |
javax.jms.TemporaryQueue |
createTemporaryQueue()
API method. |
javax.jms.TemporaryTopic |
createTemporaryTopic()
API method. |
javax.jms.TextMessage |
createTextMessage()
Creates a TextMessage object. |
javax.jms.TextMessage |
createTextMessage(java.lang.String text)
Creates a TextMessage object with the specified text. |
javax.jms.Topic |
createTopic(java.lang.String topicName)
API method. |
int |
getAcknowledgeMode()
API method. |
javax.jms.MessageListener |
getMessageListener()
API method. |
int |
getQueueMessageReadMax()
Get the maximum number of messages that can be read at once from a queue for this Session. |
int |
getTopicAckBufferMax()
Get the maximum number of acknowledgements that can be buffered when using Session.DUPS_OK_ACKNOWLEDGE mode for this session. |
int |
getTopicActivationThreshold()
Get the threshold of activation for this session. |
int |
getTopicPassivationThreshold()
Get the threshold of passivation for this session. |
boolean |
getTransacted()
API method. |
boolean |
isAsyncSend()
Indicates whether the messages produced are asynchronously sent or not (without or with acknowledgment). |
boolean |
isAsyncSub()
Indicates whether the subscription request is asynchronously handled or not. |
boolean |
isAutoAck()
|
boolean |
isImplicitAck()
Indicates whether the messages consumed are implicitly acknowledged or not. |
void |
recover()
API method. |
void |
rollback()
API method. |
void |
run()
API method. |
void |
setAsyncSend(boolean asyncSend)
Sets asynchronously sending for this session. |
void |
setAsyncSub(boolean asyncSub)
Sets asynchronous subscription for this session. |
void |
setImplicitAck(boolean implicitAck)
Sets implicit acknowledge for this session. |
void |
setInMessageInterceptors(java.util.List pInInterceptors)
Sets the list of IN message interceptors. |
void |
setMessageListener(javax.jms.MessageListener messageListener)
API method. |
void |
setOutMessageInterceptors(java.util.List pOutInterceptors)
Sets the OUT message interceptor. |
void |
setQueueMessageReadMax(int queueMessageReadMax)
Set the maximum number of messages that can be read at once from a queue for this Session. |
void |
setTopicAckBufferMax(int topicAckBufferMax)
Set the maximum number of acknowledgements that can be buffered when using Session.DUPS_OK_ACKNOWLEDGE mode for this session. |
void |
setTopicActivationThreshold(int topicActivationThreshold)
Set the threshold of activation for this session. |
void |
setTopicPassivationThreshold(int topicPassivationThreshold)
Set the threshold of passivation for this session. |
void |
setTransacted(boolean t)
set transacted. |
java.lang.String |
toString()
Returns a String image of this session. |
void |
unsubscribe(java.lang.String name)
API method. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static org.objectweb.util.monolog.api.Logger logger
protected javax.jms.MessageListener messageListener
Method Detail |
---|
public boolean isImplicitAck()
This attribute is inherited from Connection at initialization, by default false.
implicitAck
public void setImplicitAck(boolean implicitAck)
Determines whether the messages produced are implicitly acknowledged or not. If set to true the messages are immediately removed from queue when delivered.
This attribute is inherited from Connection at initialization, by default false.
implicitAck
- if true sets implicit acknowledge for this session.implicitAck
public boolean isAsyncSend()
This attribute is inherited from Connection at initialization, by default false.
asyncSend
public void setAsyncSend(boolean asyncSend)
Determines whether the messages produced are asynchronously sent or not (without or with acknowledgement).
This attribute is inherited from Connection at initialization, by default false.
asyncSend
- if true sets asynchronous sending for this session.asyncSend
public final int getQueueMessageReadMax()
This attribute is inherited from Connection at initialization, default value is 1.
queueMessageReadMax
public void setQueueMessageReadMax(int queueMessageReadMax)
This attribute is inherited from Connection at initialization, default value is 1.
queueMessageReadMax
- The maximum number of messages that can be
read at once from a queue.queueMessageReadMax
public final int getTopicAckBufferMax()
This attribute is inherited from Connection at initialization, default value is 0.
topicAckBufferMax
public void setTopicAckBufferMax(int topicAckBufferMax)
This attribute is inherited from Connection at initialization, default value is 0.
topicAckBufferMax
- The Maximum number of acknowledgements that
can be buffered in Session.DUPS_OK_ACKNOWLEDGE
mode.topicAckBufferMax
public final int getTopicPassivationThreshold()
This threshold is the maximum messages number over which the subscription is passivated.
This attribute is inherited from Connection at initialization, default value is Integer.MAX_VALUE.
topicPassivationThreshold
public void setTopicPassivationThreshold(int topicPassivationThreshold)
This threshold is the maximum messages number over which the subscription is passivated.
This attribute is inherited from Connection at initialization, default value is Integer.MAX_VALUE.
topicPassivationThreshold
- The maximum messages number over which
the subscription is passivated.topicPassivationThreshold
public final int getTopicActivationThreshold()
This threshold is the minimum messages number below which the subscription is activated.
This attribute is inherited from Connection at initialization, default value is 0.
topicActivationThreshold
public void setTopicActivationThreshold(int topicActivationThreshold)
This threshold is the minimum messages number below which the subscription is activated.
This attribute is inherited from Connection at initialization, default value is 0.
topicActivationThreshold
- The minimum messages number below which
the subscription is activated.topicActivationThreshold
public boolean isAsyncSub()
Default value is false, the subscription is handled synchronously so the topic must be accessible.
public void setAsyncSub(boolean asyncSub)
Determines whether the subscription request is asynchronously handled or not.
Default value is false, the subscription is handled synchronously so the topic must be accessible.
asyncSub
- if true sets asynchronous subscription for this session.public void setInMessageInterceptors(java.util.List pInInterceptors)
pInInterceptors
- public void setOutMessageInterceptors(java.util.List pOutInterceptors)
pOutInterceptor
- protected void checkClosed() throws javax.jms.IllegalStateException
javax.jms.IllegalStateException
public java.lang.String toString()
toString
in class java.lang.Object
public final int getAcknowledgeMode() throws javax.jms.JMSException
getAcknowledgeMode
in interface javax.jms.Session
javax.jms.JMSException
- Actually never thrown.public final boolean getTransacted() throws javax.jms.JMSException
getTransacted
in interface javax.jms.Session
javax.jms.IllegalStateException
- If the session is closed.
javax.jms.JMSException
public void setTransacted(boolean t)
public void setMessageListener(javax.jms.MessageListener messageListener) throws javax.jms.JMSException
setMessageListener
in interface javax.jms.Session
javax.jms.JMSException
- Actually never thrown.public javax.jms.MessageListener getMessageListener() throws javax.jms.JMSException
getMessageListener
in interface javax.jms.Session
javax.jms.JMSException
- Actually never thrown.public javax.jms.Message createMessage() throws javax.jms.JMSException
createMessage
in interface javax.jms.Session
javax.jms.IllegalStateException
- If the session is closed.
javax.jms.JMSException
public javax.jms.TextMessage createTextMessage() throws javax.jms.JMSException
TextMessage
object.
API method.
createTextMessage
in interface javax.jms.Session
javax.jms.IllegalStateException
- If the session is closed.
javax.jms.JMSException
public javax.jms.TextMessage createTextMessage(java.lang.String text) throws javax.jms.JMSException
TextMessage
object with the specified text.
API method.
createTextMessage
in interface javax.jms.Session
javax.jms.IllegalStateException
- If the session is closed.
javax.jms.JMSException
public javax.jms.BytesMessage createBytesMessage() throws javax.jms.JMSException
BytesMessage
object.
API method.
createBytesMessage
in interface javax.jms.Session
javax.jms.IllegalStateException
- If the session is closed.
javax.jms.JMSException
public javax.jms.MapMessage createMapMessage() throws javax.jms.JMSException
MapMessage
object.
API method.
createMapMessage
in interface javax.jms.Session
javax.jms.IllegalStateException
- If the session is closed.
javax.jms.JMSException
public javax.jms.ObjectMessage createObjectMessage() throws javax.jms.JMSException
ObjectMessage
object.
API method.
createObjectMessage
in interface javax.jms.Session
javax.jms.IllegalStateException
- If the session is closed.
javax.jms.JMSException
public javax.jms.ObjectMessage createObjectMessage(java.io.Serializable obj) throws javax.jms.JMSException
ObjectMessage
object.
API method.
createObjectMessage
in interface javax.jms.Session
javax.jms.IllegalStateException
- If the session is closed.
javax.jms.JMSException
public javax.jms.StreamMessage createStreamMessage() throws javax.jms.JMSException
StreamMessage
object.
API method.
createStreamMessage
in interface javax.jms.Session
javax.jms.IllegalStateException
- If the session is closed.
javax.jms.JMSException
public javax.jms.QueueBrowser createBrowser(javax.jms.Queue queue, java.lang.String selector) throws javax.jms.JMSException
createBrowser
in interface javax.jms.Session
queue
- the queue to browseselector
- the expression allowing to filter messages
javax.jms.IllegalStateException
- if the session is closed.
javax.jms.InvalidDestinationException
- if an invalid destination is specified.
javax.jms.InvalidSelectorException
- if the message selector is invalid.
javax.jms.JMSException
public javax.jms.QueueBrowser createBrowser(javax.jms.Queue queue) throws javax.jms.JMSException
createBrowser
in interface javax.jms.Session
queue
- the queue to browse
javax.jms.IllegalStateException
- if the session is closed.
javax.jms.InvalidDestinationException
- if an invalid destination is specified.
javax.jms.JMSException
public javax.jms.MessageProducer createProducer(javax.jms.Destination dest) throws javax.jms.JMSException
createProducer
in interface javax.jms.Session
dest
- the Destination to send to, or null if this is a producer which does not have
a specified destination.
javax.jms.InvalidDestinationException
- if an invalid destination is specified.
javax.jms.IllegalStateException
- If the session is closed or if the connection is broken.
javax.jms.JMSException
- If the creation fails for any other reason.public javax.jms.MessageConsumer createConsumer(javax.jms.Destination dest, java.lang.String selector, boolean noLocal) throws javax.jms.JMSException
createConsumer
in interface javax.jms.Session
dest
- the Destination to send to, or null if this is a producer which does not have
a specified destination.
javax.jms.InvalidDestinationException
- if an invalid destination is specified.
javax.jms.IllegalStateException
- If the session is closed or if the
connection is broken.
javax.jms.JMSException
- If the creation fails for any other reason.public javax.jms.MessageConsumer createConsumer(javax.jms.Destination dest, java.lang.String selector) throws javax.jms.JMSException
createConsumer
in interface javax.jms.Session
dest
- the Destination to send to, or null if this is a producer which does not have
a specified destination.selector
- The selector allowing to filter messages.
javax.jms.InvalidDestinationException
- if an invalid destination is specified.
javax.jms.IllegalStateException
- If the session is closed or if the
connection is broken.
javax.jms.JMSException
- If the creation fails for any other reason.public javax.jms.MessageConsumer createConsumer(javax.jms.Destination dest) throws javax.jms.JMSException
createConsumer
in interface javax.jms.Session
javax.jms.InvalidDestinationException
- if an invalid destination is specified.
javax.jms.IllegalStateException
- If the session is closed or if the
connection is broken.
javax.jms.JMSException
- If the creation fails for any other reason.public javax.jms.TopicSubscriber createDurableSubscriber(javax.jms.Topic topic, java.lang.String name, java.lang.String selector, boolean noLocal) throws javax.jms.JMSException
createDurableSubscriber
in interface javax.jms.Session
javax.jms.InvalidDestinationException
- if an invalid destination is specified.
javax.jms.IllegalStateException
- If the session is closed or if the
connection is broken.
javax.jms.JMSException
- If the creation fails for any other reason.public javax.jms.TopicSubscriber createDurableSubscriber(javax.jms.Topic topic, java.lang.String name) throws javax.jms.JMSException
createDurableSubscriber
in interface javax.jms.Session
javax.jms.InvalidDestinationException
- if an invalid destination is specified.
javax.jms.IllegalStateException
- If the session is closed or if the
connection is broken.
javax.jms.JMSException
- If the creation fails for any other reason.public javax.jms.Queue createQueue(java.lang.String queueName) throws javax.jms.JMSException
createQueue
in interface javax.jms.Session
javax.jms.IllegalStateException
- If the session is closed.
javax.jms.JMSException
public javax.jms.Topic createTopic(java.lang.String topicName) throws javax.jms.JMSException
createTopic
in interface javax.jms.Session
javax.jms.IllegalStateException
- If the session is closed.
javax.jms.JMSException
- If the topic creation failed.public javax.jms.TemporaryQueue createTemporaryQueue() throws javax.jms.JMSException
createTemporaryQueue
in interface javax.jms.Session
javax.jms.IllegalStateException
- If the session is closed or if the
connection is broken.
javax.jms.JMSException
- If the request fails for any other reason.public javax.jms.TemporaryTopic createTemporaryTopic() throws javax.jms.JMSException
createTemporaryTopic
in interface javax.jms.Session
javax.jms.IllegalStateException
- If the session is closed or if the
connection is broken.
javax.jms.JMSException
- If the request fails for any other reason.public void run()
run
in interface java.lang.Runnable
run
in interface javax.jms.Session
public void commit() throws javax.jms.JMSException
commit
in interface javax.jms.Session
javax.jms.IllegalStateException
- If the session is closed, or not
transacted, or if the connection is broken.
javax.jms.JMSException
public void rollback() throws javax.jms.JMSException
rollback
in interface javax.jms.Session
javax.jms.IllegalStateException
- If the session is closed, or not
transacted.
javax.jms.JMSException
public void recover() throws javax.jms.JMSException
recover
in interface javax.jms.Session
javax.jms.IllegalStateException
- If the session is closed, or transacted.
javax.jms.JMSException
public void unsubscribe(java.lang.String name) throws javax.jms.JMSException
unsubscribe
in interface javax.jms.Session
javax.jms.IllegalStateException
- If the session is closed or if the
connection is broken.
javax.jms.InvalidDestinationException
- If the subscription does not
exist.
javax.jms.JMSException
- If the request fails for any other reason.public void close() throws javax.jms.JMSException
close
in interface javax.jms.Session
javax.jms.JMSException
protected void addConsumer(MessageConsumer mc)
protected void addProducer(MessageProducer mp)
public final boolean isAutoAck()
|
Joram 5.3.1 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |