10.12.2012 Views

The Java EE 5 Tutorial (PDF) - Oracle Software Downloads

The Java EE 5 Tutorial (PDF) - Oracle Software Downloads

The Java EE 5 Tutorial (PDF) - Oracle Software Downloads

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

Creating Deployment Descriptors for Message-Driven Beans<br />

Creating Deployment Descriptors for Message-Driven Beans<br />

680<br />

By using resource injection and annotations, you avoid having to create a standard<br />

ejb-jar.xml deployment descriptor file for a message-driven bean. However, in certain<br />

situations you still need a deployment descriptor specific to the Application Server, in the file<br />

sun-ejb-jar.xml.<br />

You are likely to need a deployment descriptor if the message-driven bean will consume<br />

messages from a remote system. You use the deployment descriptor to specify the connection<br />

factory that points to the remote system. <strong>The</strong> deployment descriptor would look something like<br />

this:<br />

<br />

<br />

<br />

MessageBean<br />

<br />

jms/JupiterConnectionFactory<br />

<br />

<br />

<br />

<br />

<strong>The</strong> ejb element for the message-driven bean contains the following:<br />

■ <strong>The</strong> ejb-name element contains the package name of the bean class.<br />

■ <strong>The</strong> mdb-connection-factory element contains a jndi-name element that specifies the<br />

connection factory for the bean.<br />

For an example of the use of such a deployment descriptor, see “An Application Example That<br />

Consumes Messages from a Remote Server” on page 971.<br />

<strong>The</strong> <strong>Java</strong> <strong>EE</strong> 5<strong>Tutorial</strong> • June 2010

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

Saved successfully!

Ooh no, something went wrong!