• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

What is synchronized JMS request/reply best practice?

 
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Ranchers,
I have just tried synchronized JMS request/reply based on example of JavaEE5. I use netbeans IDE with nested glassfish app server as working environment. No matter I use transaction or not, the session bean can't receive the reply of the request it just sent out. With a web tier client POJO, it is fine to send and receive thereafter. Could you share your experience regarding this? Is it specific to glassfish or all of the app servers are similar?

JavaEE5 just say that you can't do them in the same transaction. so I anotate the bean method with "NOT_SUPPORTED"transaction attribute on the method. but it doesn't work at all. By the way, I also tried the JMS session creation with transaction parameter both true and false. the request can be sent out, and the remote MDB also processed the reqeust and sent back the reply to the specified Queue, however, the receiver can't get it within that session bean.

 
Ranch Hand
Posts: 254
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I have just tried synchronized JMS request/reply based on example of JavaEE5



I'm assuming you mean "synchronous" here.

JavaEE5 just say that you can't do them in the same transaction. so I anotate the bean method with "NOT_SUPPORTED"transaction attribute on the method. but it doesn't work at all.



Container provided JMS resource managers require a transaction when sending or receiving messages. If you try and send a JMS message without a transaction, the message will never be sent. Messages are only sent when the current transaction commits.

If I was you I'd try using bean-managed transactions, that way you get the fine grained control you need for this kind of task. For example.



I'm sure if you Google on this topic you'll find plenty of examples.
 
mimi mang
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Mr. Wright! You are correct. That works fine this way. I was worry about I have to expose JMS service to web tier.

The following links are useful in case someone search the same topic:

http://blogs.sun.com/fkieviet/entry/request_reply_from_an_ejb
http://forums.sun.com/thread.jspa?threadID=5238565

just send you a private message!

Merry Christmas and Happy New Year!
 
I AM MIGHTY! Especially when I hold this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!