users@glassfish.java.net

Delivery of JMS message in case of distributed transaction

From: <glassfish_at_javadesktop.org>
Date: Thu, 18 Jun 2009 08:58:40 PDT

I have a general question about distributed transactions, and how other people deal with them in the real world.

We use in our of our project an Oracle database plus a few JMS queues. We have SLSB in charge to insert some data into the database then send a JMS for asynchronous processing.

This works fine, but we have realized that sometimes the message is delivered before the changes in database were committed. This means that we sometimes read stale data, which is a serious issue. Our workaround is to lock the row before reading (or use "select ... for update") so that the message processing will wait until the original transaction is completed.

This seems to me like a basic scenario and I guess that other people also faced a similar problem. I'm wondering how other people solved this issue?
[Message sent by forum member 'ewernli' (ewernli)]

http://forums.java.net/jive/thread.jspa?messageID=351867