Rollback JMS message ? [message #268441] |
Tue, 18 September 2007 11:44 |
tartufe
Messages: 1 Registered: September 2007
|
Junior Member |
|
|
Hi,
I've certainly missed something but i didn't found any solution to my problem with OracleAQ and JMS dequeuing.
My application read messages from OracleAQ. Each message are processed and sent to a destination (other jms system, database etc...) in the same order as they were published.
My application could be stopped even if a message processing is in progress. In this case, message should be rollbacked and reprocessed after.
Here is my problem, every rollback/recover call, put current message in ExceptionQueue with "EXPIRED" status so i can't receive this message an other time. OracleAQ queue is a "NORMAL_QUEUE" not an "EXCEPTION_QUEUE", DB is version 9.2.0. Here is a sample code that show my problem :
Properties pr = new Properties();
String url = "jdbc:oracle:thin:@host:1234:SID";
QueueConnectionFactory qcf = AQjmsFactory.getQueueConnectionFactory(url, pr);
QueueConnection qc = qcf.createQueueConnection("user", "password");
qc.start();
QueueSession session = qc.createQueueSession(true, 0);
Queue q = session.createQueue("MyQueue");
QueueReceiver jmsReceiver = session.createReceiver(q);
Message msg = jmsReceiver.receiveNoWait();
System.out.println(msg.getJMSCorrelationID());
session.recover();
session.rollback();
msg = jmsReceiver.receiveNoWait();
System.out.println(msg.getJMSCorrelationID());
If oracle AQ queue have two message (m1 and m2) i get this output :
m1
m2
What's wrong ? How could i have this output :
m1
m1
ie: how could i use rollback in jms dequeuing ?
Regards
|
|
|