hi,
In a session bean transation I am inserting a record to the database and putting a message to a JMS queue. The session bean method is transaction enabled and my problem is the JMS message consumer can consume the message before commiting the session bean method transaction.
Actually the consumer refers to the inserted record to the Database when processing the message, and sometimes it fails since consumer can pop the message from the queue even before session bean commits the transaction. (Database will be updating at the point of session bean commiting the message)
Please let me know if there is a solution for this issue.
-
EJB transaction with JMS (3 messages)
- Posted by: Nadika Ranasinghe
- Posted on: March 16 2004 08:37 EST
Threaded Messages (3)
- EJB transaction with JMS by Shreeram Iyer on March 16 2004 09:28 EST
- EJB transaction with JMS by Tomas Inger on March 16 2004 11:41 EST
- EJB transaction with JMS by N Naresh Kumar on March 17 2004 09:20 EST
-
EJB transaction with JMS[ Go to top ]
- Posted by: Shreeram Iyer
- Posted on: March 16 2004 09:28 EST
- in response to Nadika Ranasinghe
Can't you not delay posting the message onto the queue till the Session bean commits the record to the DB? That way you can be sure that when the Consumer picks up the message from the queue/topic, the record will already be there in the Database.
-Shree -
EJB transaction with JMS[ Go to top ]
- Posted by: Tomas Inger
- Posted on: March 16 2004 11:41 EST
- in response to Shreeram Iyer
Hi!
I think the "puch to JMS queue" should be a part of the transaction. This means, the message will be rolled back if you (or the EJB container) makes a rollback.
So, I recommend you to check the transaction handling between the EJB server and the JMS implementation.
/Tomas -
EJB transaction with JMS[ Go to top ]
- Posted by: N Naresh Kumar
- Posted on: March 17 2004 09:20 EST
- in response to Nadika Ranasinghe
I think it depends on whether the bean is Stateful or Stateless if the bean is Stateless then you can use Message Driven Bean instead,
As there are some similarities between Stateless and Message Driven Bean
Let me know the problem properly whether u are dealing with stateful or stateless
Thanks,
N.Naresh Kumar