• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Message Driven beans

 
bhargavi kakarala
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,
just confused.
1)Are MDBs used only with entitybeans.
2)Exactly in what type of situations are these usedcan someone explain with a small example.
3)Iam confused with difference between Topcis(durable & nondurable),queues
thanks in advance.
 
Anthony Watson
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Message Driven Beans and Entity Beans are two different things and are not necessarily used together. Message Driven beans are used for asynchronous communications. This way, a client can call a method on an mdb and continue doing other things. Session and Entity Beans are synchronous. That means that after a client calls a method on one of them, it has to wait until they it returns something before the client can continue. Topics are for a publish-subscribe functionality, where I can send a message to a topic and it can be received by anyone listening in (kindof like a chat room post). Queues are for point to point communications where I send a message to only one listener.
 
Keith Rosenfield
Ranch Hand
Posts: 277
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Anthony:
Originally posted by Anthony Watson:
This way, a client can call a method on an mdb and continue doing other things. Session and Entity Beans are synchronous. That means that after a client calls a method on one of them, it has to wait until they it returns something before the client can continue.

It is not the case that a "client calls a method on one of them". Clients will NEVER call a method on a MDB because it can not get a reference to it. It is the container's job to call the onMessage() method of the bean when appropriate as well as the lifecycle methods. It is true though that the client will not be blocked after sending a message.
Hope this helps.
 
Anthony Watson
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You know what I mean, Keith. You will run out of breath and get carple tunnels syndrome if you use the precise, long winded way of describing the ejb process. I still feel that I answered the guy's question.
 
Keith Rosenfield
Ranch Hand
Posts: 277
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Anthony:
Originally posted by Anthony Watson:
You know what I mean, Keith. You will run out of breath and get carple tunnels syndrome if you use the precise, long winded way of describing the ejb process. I still feel that I answered the guy's question.

In this field, precision is a neccesity. If you say A, I will not assume you mean B. I also beleive in being concise but not at the expense of clarity.
Peace
[ January 15, 2004: Message edited by: Keith Rosenfield ]
 
Kathy Sierra
Cowgirl and Author
Rancher
Posts: 1589
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Keith Rosenfield:
Hey Anthony:
In this field, precision is a neccesity. If you say A, I will not assume you mean B. I also beleive in being concise but not at the expense of clarity.

Howdy folks. I think I have to agree with Keith on this point, for *this* forum (as opposed to the regular non-certification EJB forum, where I think Anthony's "shorthand" is exactly the way we discuss things in the real world.)
But it has definitely been my experience that if you say something that might be *parsed* a little differently by someone who is new to the technology, people *will* be confused. I know because I make some of those shortcuts myself in the book, and I always end up getting lots of (justified) questions and complaints.
So if I *say* "a client calls an MDB" there will definitely be newcomers who will be confused into thinking, "wait a minute... if an MDB does not have a component interface, then how does this happen?" We have to assume that there are people who are still in the learning stages and may be in the most basic level of understanding. Or, there may be folks just coming in from EJB 1.1 and so they really have no prior knowledge or experience with the new things like local interfaces or MDBs.
Anthony, you give such awesome and detailed explanations. They *are* very clear... except for the occasional shorthand. So I'd like to second what Keith said and suggest that you risk a little more carpal tunnel and assume that in THIS forum, there might be hundreds of lurkers who are at square one, and will take your words literally. So if you say, "client has a reference to a bean..." they'll take it to mean "client has a reference to an instance of a bean".
It has been very hard for me, for example, to try to get into the habit of *always* saying, "Client has a reference to an entity bean's component interface..." (especially since I came from EJB 1.1, were there the "component" interface was known only as "the remote interface").
Anyway, I think you're doing a TON to help people out here. I think I've picked up a few things from your explanations that I can really use, so thank-you. I also think Keith is doing a really good job of smoking out all those confusing or seemingly contradictory corners of the spec (or my book ).
Thanks again to everyone who has been answering questions and ESPECIALLY to those brave enough to ask them
Remember: there ARE no dumb questions.
cheers,
kathy
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic