Can anybody tell the best scenario of MDB(Message Driven bean) communicating with other beans like sessio beans.What is the best benifit we get if embed these two,
Thanks
-krish
-
MDB and Session Beans (8 messages)
- Posted by: Hari
- Posted on: November 16 2002 01:43 EST
Threaded Messages (8)
- MDB and Session Beans by Mohit Sehgal on November 16 2002 03:50 EST
- MDB and Session Beans by Hari on November 17 2002 03:58 EST
-
MDB and Session Beans by Glen Klyuzner on November 17 2002 08:10 EST
- MDB and Session Beans by Hari on November 18 2002 12:48 EST
-
MDB and Session Beans by Hari on November 18 2002 12:51 EST
-
MDB and Session Beans by Glen Klyuzner on November 18 2002 06:27 EST
-
MDB and Session Beans by Sumita Tamboli on December 16 2004 02:12 EST
- MDB and Session Beans by Glen Klyuzner on April 19 2005 03:19 EDT
-
MDB and Session Beans by Sumita Tamboli on December 16 2004 02:12 EST
-
MDB and Session Beans by Glen Klyuzner on November 18 2002 06:27 EST
-
MDB and Session Beans by Glen Klyuzner on November 17 2002 08:10 EST
- MDB and Session Beans by Hari on November 17 2002 03:58 EST
-
MDB and Session Beans[ Go to top ]
- Posted by: Mohit Sehgal
- Posted on: November 16 2002 03:50 EST
- in response to Hari
You have raised a good point. Usually I back up my MDB by a session bean. I mean say, for example if the processing is asynchronous, then we need to use MDBs. But MDBs for most cases should call (delegate to) the session bean for business processing. In case we require synchronous calls (business user changes mind or business processing changes), then the same session bean can be used without any refactoring of code
Mohit -
MDB and Session Beans[ Go to top ]
- Posted by: Hari
- Posted on: November 17 2002 03:58 EST
- in response to Mohit Sehgal
Mohit, You mean to say, for asynchronous processing it is better mdb call session bean.so session bean is backed of session bean.If it is like this there is point that client can not call mdb directly.So how can this flow goes? I got cofused the flow of beans (which one call which one).can you please explain
Regards, Harikrishna -
MDB and Session Beans[ Go to top ]
- Posted by: Glen Klyuzner
- Posted on: November 17 2002 20:10 EST
- in response to Hari
Hari,
Mohit meant that the same Session Bean can be used for processing of synchronous requests from the client (aka HTTP request from Web server) and from MDB. In case of MDB it is acting as a client to the same session bean. The only difference is that MDB is started by j2EE container based on incoming message and the session bean CANNOT return any result back to the original client unless it using messaging. You can keep the business logic in Session Bean and use it to serve client or MDB request.
I think first of all you have to get clear picture what is MDB. Sorry it may not sound polite, but based on you question it looks like that you do not understand MDB.
First of all client NEVER call MDB. It is up to the server (Container) to call MDB based on incoming message.
MDB more or less the same as Stateless Session bean, but for asynchronous messages.
MDB just allows J2EE container to listen outside messaging world (Topics or Queues).
Glen -
MDB and Session Beans[ Go to top ]
- Posted by: Hari
- Posted on: November 18 2002 00:48 EST
- in response to Glen Klyuzner
Thanks for the information.
Can tell me a scenarion which have the communication between Session and mdb
-hari -
MDB and Session Beans[ Go to top ]
- Posted by: Hari
- Posted on: November 18 2002 00:51 EST
- in response to Glen Klyuzner
Thanks for the information.
Can tell me a scenarion which have the communication between Session and mdb
is mdb client and session bean client are different?
-hari -
MDB and Session Beans[ Go to top ]
- Posted by: Glen Klyuzner
- Posted on: November 18 2002 18:27 EST
- in response to Hari
For example if you want to deliver result or exception back to the caller from a Session Bean business method. With MDB Client you cannot do it directly.
There are more or less the same, but with few exceptions:
1. Regular Client can call Session Bean only synchronically and can get result or exception back from a Session Bean
2. MDB Client "accepts" asynchronous request from Regular Client and delegates processing to a Session Bean and it cannot return directly result or exception back to the original requester from Session Bean's method. -
MDB and Session Beans[ Go to top ]
- Posted by: Sumita Tamboli
- Posted on: December 16 2004 14:12 EST
- in response to Glen Klyuzner
Hi Glen
You have written that with MDB we cannnot send result or exception back to client directly. I agree but could you please tell us a way in which it could be done INDIRECTLY.
i.e is there any indirect way to send back results from MDB to the client(say servlet) , may be using another message queue or something. I do understand that this will also be asynchronous.
Kindly tell that indirect way if you know of one. -
MDB and Session Beans[ Go to top ]
- Posted by: Glen Klyuzner
- Posted on: April 19 2005 15:19 EDT
- in response to Sumita Tamboli
It depends on context.
If you start transaction for MDB(onMessage(...)) and you want to send something back, then you have to spawn new transaction and send reply to desired destination(Queue,Topic, TempQueue, TempTopic) from the context of new transaction.