O'Reilly - Java Message Service
O'Reilly - Java Message Service
O'Reilly - Java Message Service
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Figure 8.1. The EJB 2.0 bean components<br />
<strong>Java</strong> <strong>Message</strong> <strong>Service</strong><br />
Application developers create custom enterprise beans by implementing one of the main<br />
bean interfaces and developing the bean according to conventions and policies dictated by<br />
the EJB specification. Entity beans are usually used for modeling business concepts that<br />
have persistent data and may be accessed by many clients concurrently. Entity beans might<br />
be used to model customers, orders, vehicles, locations, and similar objects. Session beans<br />
model business processes that may or may not have session state. Session beans might be<br />
used to model business concepts like a securities broker, an online shopping cart, loan<br />
calculation, medical claim processor - any process or mediator-type business concept.<br />
<strong>Message</strong>-driven beans are used to model stateless JMS consumers. A message-driven bean<br />
will have a pool of instances at runtime, each of which is a <strong>Message</strong>Listener. The bean<br />
instances can concurrently consume hundreds of messages delivered to the message-driven<br />
bean, which makes the message-driven bean scalable. Similar to session beans, messagedriven<br />
beans model business processes by coordinating the interaction of other beans and<br />
resources according to the messages received and their payloads.<br />
In addition to the <strong>Java</strong> classes that define a bean, every bean has an XML configuration<br />
file called a deployment descriptor. The deployment descriptor allows the bean developer<br />
to declare many of a bean's runtime behaviors including transaction policies, access control<br />
policies, and the resources (services) available. Resources ( JMS, JDBC, <strong>Java</strong>Mail, etc.)<br />
that are declared in the deployment descriptor are accessed via JNDI from the bean's<br />
environment naming context (ENC). The ENC is simply a default read-only JNDI<br />
namespace that is available to every bean at runtime. Each bean deployment has its own<br />
123