23.07.2013 Views

O'Reilly - Java Message Service

O'Reilly - Java Message Service

O'Reilly - Java Message Service

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 8. J2EE, EJB, and JMS<br />

8.1 J2EE Overview<br />

<strong>Java</strong> <strong>Message</strong> <strong>Service</strong><br />

<strong>Java</strong> 2, Enterprise Edition ( J2EE) is a specification that unites several other <strong>Java</strong><br />

enterprise technologies, including JMS, into one complete platform. J2EE is built on three<br />

main components: Enterprise <strong>Java</strong>Beans, Servlets, and <strong>Java</strong>Server Pages ( JSP). Many<br />

other technologies, such as JMS, JDBC, <strong>Java</strong>Mail, JTA, CORBA, and JNDI. are also<br />

included as services in J2EE. The <strong>Java</strong> <strong>Message</strong> <strong>Service</strong> actually has two roles in J2EE: it<br />

is both a service and the basis for a new enterprise bean type.<br />

To get a better understanding of what J2EE is, and why it is important, we need to discuss<br />

the three main components and explain how they are drawn together to form the unified<br />

J2EE platform. It is important to keep in mind that all the technologies discussed here are<br />

paper specifications licensed and implemented by vendors - a central theme in Sun<br />

Microsystems' enterprise technologies.<br />

8.1.1 Enterprise <strong>Java</strong>Beans<br />

Enterprise <strong>Java</strong>Beans (EJB) 2.0 defines a <strong>Java</strong> component model for component<br />

transaction monitors (CTMs). A CTM is a marriage of two technologies: distributed<br />

objects and transaction processing monitors (TPMs). Distributed object technologies such<br />

as CORBA, <strong>Java</strong> RMI-JRMP, and DCOM provide a networking and routing infrastructure<br />

that allows applications to access objects hosted on other processes or computers. A TPM,<br />

such as CICS or TUXEDO, provides a robust, secure, and scalable environment for<br />

running transactional applications. A CTM combines these technologies into transactional<br />

distributed objects that run in a robust, secure, and scalable environment. There are three<br />

main CTM technologies today: Sun's Enterprise <strong>Java</strong>Beans, Microsoft's COM+ (a.k.a.<br />

MTS), and the Object Management Group's CORBA Component Model (CCM). J2EE is<br />

built on EJB, which provides it with powerful transactional components that can be used to<br />

model and run an organization's business logic.<br />

Enterprise <strong>Java</strong>Beans are not at all like <strong>Java</strong> Beans. Enterprise<br />

<strong>Java</strong>Beans are nonvisual components that run on an application<br />

server. <strong>Java</strong> beans are used as visual widgets (buttons, graphs, etc.).<br />

Other than the common name "Bean" and the fact that they are both<br />

<strong>Java</strong> component technologies from Sun Microsystems, EJB and <strong>Java</strong><br />

Beans have very little in common.<br />

In Enterprise <strong>Java</strong>Beans 2.0, bean components come in three main flavors: session, entity,<br />

and message-driven beans. Session beans model processes and act as server-side<br />

extensions of their clients (they can manage a client's session state). Entity beans model<br />

persistent business objects; and combine business logic and database data. <strong>Message</strong>-driven<br />

beans, the newest bean type, are JMS clients that can consume messages concurrently in a<br />

robust and scalable EJB environment. The EJB 2.0 bean components are shown in Figure<br />

8.1.<br />

122

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!