|
Websphere MQ Everyplace | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.ibm.mqe.jms.MQeSession
A JMS Session
is a single threaded context for producing and consuming
messages. A session can create and service multiple message producers and
consumers.If a client desires to have one thread producing messages while others
consume them, the client should use a separate Session for its producing
thread.
A session may be optionally specified as transacted. Each transacted session supports a single series of transactions. Each transaction groups a set of message sends and a set of message receives into an atomic unit of work. In effect, transactions organize a session's input message stream and output message stream into series of atomic units. When a transaction commits, its atomic unit of input is acknowledged and its associated atomic unit of output is sent. If a transaction rollback is done, its sent messages are destroyed and the session's input is automatically recovered. The content of a transaction's input and output units is simply those messages that have been produced and consumed within the session's current transaction.
A transaction is completed using either its session's
commit()
or rollback()
method. The completion of a
session's current transaction automatically begins the next. The result
is that a transacted session always has a current transaction within
which its work is done.
Field Summary | |
static int |
AUTO_ACKNOWLEDGE
With this acknowledgement mode, the session automatically acknowledges a client's receipt of a message when it has either successfully returned from a call to receive or the message listener it has called to process the message successfully returns. |
static int |
CLIENT_ACKNOWLEDGE
With this acknowledgement mode, the client acknowledges a message by calling a message's acknowledge method. |
static int |
DUPS_OK_ACKNOWLEDGE
This acknowledgement mode instructs the session to lazily acknowledge the delivery of messages. |
Method Summary | |
void |
close()
Since a provider may allocate some resources on behalf of a Session outside the JVM, clients should close them when they are not needed. |
void |
commit()
Commit all messages done in this transaction and releases any locks currently held. |
javax.jms.BytesMessage |
createBytesMessage()
Create a BytesMessage. |
javax.jms.MapMessage |
createMapMessage()
Create a MapMessage. |
javax.jms.Message |
createMessage()
Create a Message. |
javax.jms.ObjectMessage |
createObjectMessage()
Create an ObjectMessage. |
javax.jms.ObjectMessage |
createObjectMessage(java.io.Serializable object)
Create an initialized ObjectMessage. |
javax.jms.StreamMessage |
createStreamMessage()
Create a StreamMessage. |
javax.jms.TextMessage |
createTextMessage()
Create a TextMessage. |
javax.jms.TextMessage |
createTextMessage(java.lang.String string)
Create an initialized TextMessage. |
int |
getAcknowledgementMode()
get the acknowledgement mode for this session. |
javax.jms.MessageListener |
getMessageListener()
Return the session's distinguished message listener. |
boolean |
getTransacted()
Is the session in transacted mode? |
void |
recover()
Stop message delivery in this session, and restart sending messages with the oldest unacknowledged message. |
void |
rollback()
Rollback any messages done in this transaction and releases any locks currently held. |
void |
setMessageListener(javax.jms.MessageListener listener)
Set the session's distinguished message listener. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface javax.jms.Session |
run |
Field Detail |
public static final int AUTO_ACKNOWLEDGE
public static final int CLIENT_ACKNOWLEDGE
public static final int DUPS_OK_ACKNOWLEDGE
Method Detail |
public javax.jms.BytesMessage createBytesMessage() throws javax.jms.JMSException
createBytesMessage
in interface javax.jms.Session
javax.jms.JMSException
- if JMS fails to create this message
due to some internal error.public javax.jms.MapMessage createMapMessage() throws javax.jms.JMSException
createMapMessage
in interface javax.jms.Session
javax.jms.JMSException
- if JMS fails to create this message
due to some internal error.public javax.jms.Message createMessage() throws javax.jms.JMSException
createMessage
in interface javax.jms.Session
javax.jms.JMSException
- if JMS fails to create this message
due to some internal error.public javax.jms.ObjectMessage createObjectMessage() throws javax.jms.JMSException
createObjectMessage
in interface javax.jms.Session
javax.jms.JMSException
- if JMS fails to create this message
due to some internal error.public javax.jms.ObjectMessage createObjectMessage(java.io.Serializable object) throws javax.jms.JMSException
createObjectMessage
in interface javax.jms.Session
object
- the object to use to initialize this message.
javax.jms.JMSException
- if JMS fails to create this message
due to some internal error.public javax.jms.StreamMessage createStreamMessage() throws javax.jms.JMSException
createStreamMessage
in interface javax.jms.Session
javax.jms.JMSException
- if JMS fails to create this message
due to some internal error.public javax.jms.TextMessage createTextMessage() throws javax.jms.JMSException
createTextMessage
in interface javax.jms.Session
javax.jms.JMSException
- if JMS fails to create this message
due to some internal error.public javax.jms.TextMessage createTextMessage(java.lang.String string) throws javax.jms.JMSException
createTextMessage
in interface javax.jms.Session
string
- the string used to initialize this message.
javax.jms.JMSException
- if JMS fails to create this message
due to some internal error.public boolean getTransacted() throws javax.jms.JMSException
getTransacted
in interface javax.jms.Session
javax.jms.JMSException
- if JMS fails to return the transaction
mode due to internal error in JMS Provider.public void commit() throws javax.jms.JMSException
commit
in interface javax.jms.Session
javax.jms.JMSException
- if JMS implementation fails to commit the
the transaction due to some internal error.
javax.jms.TransactionRolledBackException
- if the transaction
gets rolled back due to some internal error
during commit.
javax.jms.IllegalStateException
- if the session is closed or if an async
listener is using the session thread.public void rollback() throws javax.jms.JMSException
rollback
in interface javax.jms.Session
javax.jms.JMSException
- if JMS implementation fails to rollback the
the transaction due to some internal error.public void close() throws javax.jms.JMSException
close
in interface javax.jms.Session
javax.jms.JMSException
- if JMS implementation fails to close a
Session due to some internal error.public void recover() throws javax.jms.JMSException
recover
in interface javax.jms.Session
javax.jms.JMSException
- if JMS implementation fails to stop message
delivery and restart message send due to
due to some internal error.public javax.jms.MessageListener getMessageListener() throws javax.jms.JMSException
getMessageListener
in interface javax.jms.Session
javax.jms.JMSException
- as this method is not supported.
public void setMessageListener(javax.jms.MessageListener listener) throws javax.jms.JMSException
setMessageListener
in interface javax.jms.Session
javax.jms.JMSException
- as this method is not supported.
public int getAcknowledgementMode()
AUTO_ACKNOWLEDGE
, CLIENT_ACKNOWLEDGE
or DUPS_OK_ACKNOWLEDGE
|
Websphere MQ Everyplace | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |