Hi In the Message facade pattern, the client send the JMS to the Message drive beans. how can he call the MDB? Becaseu there is no client-view in the MDB. how it is possible. Thanks and regards Anna Madhusudhanan
Hi. An MDB is a special type of EJB - it doesn't have any method for the client to call. More than that - it doesn't have any method for anyone to call. When you deploy the MDB, you specify the destination (queue/topic) that it will listen on. From then on, it it the application server's responsibility to call this MDB's onMessage() method when a message arrives at that destination. This contract is the only thing that you can rely on. Nothing else. Therefore, when you use an MDB to listen on a destination, all you do is program that onMessage() method to do the work for you. From this method you may call other EJBs, log stuff to file, send messages to other destinations, etc. Nimo.
No client ever talks to an EJB. A client sends message to a destination, which is either a queue or a topic. For asynchronous messaging, the Container will invoke the MessageListener's onMessage() method. If the consumer is an MDB, which is a type of MessageListener, the Container will pull an MDB instance from the pool to service the call. The MDB is a MessageListener, kind of like an event listener but receives messages of type javax.jms.Message (passed into the onMessage() method) rather than events.