Message-Driven Bean
<blockquote><a name="wp79967" />What Is a Message-Driven Bean?<a name="wp79973" />A message-driven bean is an enterprise bean that allows J2EE applications to process messages asynchronously. It normally acts as a JMS message listener, which is similar to an event listener except that it receives JMS messages instead of events. The messages can be sent by any J2EE component--an application client, another enterprise bean, or a web component--or by a JMS application or system that does not use J2EE technology. Message-driven beans can process either JMS messages or other kinds of messages.
<a name="wp79982" />For a simple code sample, see Chapter 28<a href="http://java.sun.com/j2ee/1.4/docs/tutorial/doc/MDB.html#wp82308" />. For more information about using message-driven beans, see Using the JMS API in a J2EE Application and Chapter 34.
<a name="wp79983" />What Makes Message-Driven Beans Different from Session and Entity Beans?
<a name="wp79984" />The most visible difference between message-driven beans and session and entity beans is that clients do not access message-driven beans through interfaces. Interfaces are described in the section Defining Client Access with Interfaces. Unlike a session or entity bean, a message-driven bean has only a bean class.
<a name="wp79990" />In several respects, a message-driven bean resembles a stateless session bean.
<div class="pSmartList1"><ul class="pSmartList1"><a name="wp79991" /> <div class="pSmartList1"> A message-driven bean's instances retain no data or conversational state for a specific client.
页:
[1]