« How to Use JMS to Send Text Messages B/W 2 Clients - Oracle AQJMS | Main | Message Persistence - Oracle AQJMS »

Transacted and Non Transacted Sessions - Oracle AQJMS

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();

TrackBack

TrackBack URL for this entry:
http://blogs.oracle.com/mte1521/mt-tb.cgi/8207

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)

About This Entry

This page contains a single entry from the blog posted on October 23, 2008 5:44 AM.

The previous post in this blog was How to Use JMS to Send Text Messages B/W 2 Clients - Oracle AQJMS.

The next post in this blog is Message Persistence - Oracle AQJMS.

Many more can be found on the main index page or by looking through the archives.

Top Tags

Powered by
Movable Type and Oracle