Win a copy of Java 9 Revealed this week in the Features new in Java 9 forum!
    Bookmark Topic Watch Topic
  • New Topic

entityManager.persist and JMS messaging issues?  RSS feed

 
j mao
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hi everyone:

I am seeing a problem that I could not figure out a solution. Can anyone shed me some lights on this?

I have a EJB method which basically does 2 things: 1). persists a record into a database table using EntityManager 2). sends out a message to a JMS topic. So it is th like:

myMethod() {
entityManager.persist(myObj);
notifier.notify(...);
}

The client will then listen to the JMS topic and read the new record from database. Usually this works pretty well, but sometimes, the client cannot find the new record from database at all and a few seconds later it can. It is as if there is a delay between the JMS messaging and database persistence - somehow the client receives the message first and at this time the record is not really saved into database yet!

Can anyone explain to me what is going on here? What kind of solutions might help to resolve this?

BTW, I am using the Hibernate EntityManager. My app server is Glassfish.

Thanks a lot for your help

jmao



 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65897
135
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Report post to moderator
"tiger bunny", please do not cross-post the same question in multiple forums. It wastes people's time when multiple redundant conversations take place. Please read this for more information.

And, please check your private messages for an important administrative matter.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!