To a client, a message-driven bean is simply a JMS message consumer. The client sends messages to the Destination (Queue or Topic) for which the message-driven bean is the MessageListener just as it would to any other Destination. The message-driven bean, like any other JMS message consumer, handles the processing of the messages.
From the perspective of the client, the existence of a message-driven bean is completely hidden behind the JMS destination for which the message-driven bean is the message listener.
A client locates the JMS Destination associated with a message-driven bean by using JNDI. For example, the Queue for the StockInfo message-driven bean can be located using the following code segment:
Context initialContext = new InitialContext(); Queue stockInfoQueue = (javax.jms.Queue)initialContext.lookup ("java:comp/env/jms/stockInfoQueue");Message-driven beans don't have home/local home and remote/local interfaces.
A client's JNDI name space may be configured to include the JMS Destinations of message-driven beans installed in MULTIPLE EJB Containers located on MULTIPLE machines on a NETWORK. The actual locations of an enterprise bean and EJB Container are, in general, transparent to the client using the enterprise bean.
When a client sends a message to a Destination for which a message-driven bean is the consumer, the container selects one of its METHOD-READY instances and invokes the instance's onMessage method.
The following steps describe the lifecyle of a message-driven bean instance:
The table defines the methods of a message-driven bean class in which the message-driven bean instances can access the methods of the javax.ejb.MessageDrivenContext interface, the java:comp/env environment naming context, resource managers, and other enterprise beans.
Table 10.1. Operations allowed in the methods of a message-driven bean class
The reasons for disallowing operations in the table:
SCJP 6.0 Simulator 664+ Questions With Explanations
SCWCD 5.0 Simulator 556+ Questions With Explanations
SCWCD 4.0 Simulator 500+ Questions With Explanations
OCA 10g Simulator 594+ Questions With Explanations
Hiring made easy Harness social networking, employee referrals, Agency portal and Job Portals