• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Message Driven Beans Syn/Async ?

 
Ranch Hand
Posts: 351
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello !
Can anyone tell me if message driven beans are used for synchornous or asynchonous messaging ? How do they differ if it is possible to use them in either ways ?
Thanks and Regards,
Leena
 
Ranch Hand
Posts: 547
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi
you can consume messages both, snyc and async.
as far as i know, please correct me if im wrong:
for asnyc processing you set a MessageListener (implement the onMessage method) and just wait for incomming messages.
p
 
Ranch Hand
Posts: 2713
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
JMS is asynchronous, meaning the producer does not have to wait for the consumer. The consumer can block if they want but it is of no concern to the producer of the message.
 
Ranch Hand
Posts: 273
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A client may either synchronously receive a message consumer's messages or have the consumer asynchronously deliver them as they arrive.

For synchronous receipt, a client can request the next message from a message consumer using one of its receive methods. There are several variations of receive that allow a client to poll or wait for the next message.

For asynchronous delivery, a client can register a MessageListener object with a message consumer. As messages arrive at the message consumer, it delivers them by calling the MessageListener's onMessage method.
 
Ranch Hand
Posts: 704
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Leena,


Can anyone tell me if message driven beans are used for synchornous or asynchonous messaging ?


MDBs don�t have any way to interact directly with the clients; this is why they have no home or remote interfaces. Therefore it makes no sense for MDBs to process messages synchronously. Even more, this is actually the reason why EJB 2.0 introduced the MDBs in the first place: prior the developers were forced to use all kind of "tricks", like startup classes in order to register an asynchronous listener to a JMS destination.
Regards.
reply
    Bookmark Topic Watch Topic
  • New Topic