NonStop JMS User's Manual (H06.03+, J06.03+, NonStop JMS 3.0+)
NSJMS and JMS Client Applications
NonStop Server for Java Message Service User’s Manual—522356-006
4-6
Transactions
Both the createQueueSession() method and the createTopicSession() 
method accept a boolean parameter that specifies whether the session is transacted.
Transactions
NSJMS supports transacted sessions and external transactions. Transacted sessions 
allow you to send and receive multiple messages in a single transaction that is local to 
the session. External transactions are inherited transactions that start and end external 
to NSJMS and allow you to combine other database or server work with the same 
transaction that reads or sends messages. External transactions are defined using 
either the current class methods or the JTA both of which are described in the NonStop 
Server for Java Programmer’s Reference.
The JMS client process' current TMF transaction is inherited by NSJMS send-and-
receive operations. If no current transaction exists, a transaction is started within 
NSJMS and committed within NSJMS.
Messages sent within a transaction are received by consumers only after the 
transaction is committed. Messages received from a queue within a transaction are not 
removed from the queue until the transaction is committed.
Transacted Sessions
JMS sessions are created as transacted sessions. Transacted sessions use JMS 
commit() and rollback() methods to commit or abort the transaction started for 
the session. NSJMS supports transacted sessions, but the use of external transactions 
overrides the transacted session. Within a transacted session, an external transaction 
can send and receive messages. The JMS session commit() and rollback() 
methods affects only those operations that were performed without an external 
transaction.
Non-Transacted Sessions
Non-Transacted sessions use client acknowledgment to signal when receives are 
committed. Client acknowledgment is determined by a mode established for the 
session and can be implicit (AUTO_ACKNOWLEDGE and DUPS_OK_ACKNOWLEDGE) or 
explicit (CLIENT_ACKNOWLEDGE). An external transaction overrides the client 
acknowledgment mode. A client's explicit message acknowledgment acknowledges 
only those messages received without an external transaction.
Caution. When a transacted session is used to receive messages and an external transaction 
is started without first issuing a commit() or rollback() method for the transacted session, 
an error may occur if a receive() method is issued under the external transaction. This is 
because two active transactions are associated with the cursor used to read messages. The 
transacted session should be committed or rolled back before using the external transaction.
When writing JMS client code, check that no more than one current transaction exists for each 
subscriber, receiver, or publisher.










