It's not a secret anymore!
The moose likes EJB and other Java EE Technologies and the fly likes Message Driven Beans Syn/Async ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Message Driven Beans Syn/Async ?" Watch "Message Driven Beans Syn/Async ?" New topic

Message Driven Beans Syn/Async ?

Leena Diwan
Ranch Hand

Joined: Jun 18, 2001
Posts: 351
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,

pascal betz
Ranch Hand

Joined: Jun 19, 2001
Posts: 547
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.
Chris Mathews
Ranch Hand

Joined: Jul 18, 2001
Posts: 2712
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.
Gurumurthy Ramamurthy
Ranch Hand

Joined: Feb 13, 2003
Posts: 273
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.
Valentin Tanase
Ranch Hand

Joined: Feb 17, 2005
Posts: 704
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.

I think, therefore I exist -- Rene Descartes
I agree. Here's the link:
subject: Message Driven Beans Syn/Async ?
It's not a secret anymore!