Oracle AQJMS Transacted & Not Transacted Session Example.
A session provides a transactional context with which to group a set of sends and receives into an atomic unit of work.
1. Remove Non Transacted statement shown below in JMSClient1 and JMSClient2 classes from Example1
QueueSession m_queueSess = qc.createQueueSession(false, Session.AUTO_ACKNOWLEDGE)
2. Add Transacted statement shown below in JMSClient1 and JMSClient2 classes in the Example1
QueueSession m_queueSess = qc.createQueueSession(true, 0);
3. Create MultipleText Messages in JMSClient1
Message mesg1 = m_queueSess.createTextMessage("Test1 Message");
Message mesg2 = m_queueSess.createTextMessage("Test2 Message");
4. send Above messages to Q.
m_sender.send(mesg1);
m_sender.send(mesg2);
5. The Above Messages gets Queued only if you call Session Commit statement after sending message to Q else Messages are rollback.
m_queueSess.Commit();
6. Receive Above messages from Q in JMSClient2.
m_sender.receive(mesg);
m_sender.receive(mesg);
5. The Above Messages removed from Queue only if you call Session Commit statement after receiving message from Q else Messages are remain in Q after maximum
retry is reached.
m_queueSess.Commit();