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.

cd producer<br />

2. To create all the resources, type the following command:<br />

ant create-resources<br />

To create only the topic resource, type the following command:<br />

ant create-topic<br />

<strong>The</strong>se Ant targets use the asadmin create-jms-resource command to create the connection<br />

factory and the destination resources.<br />

To verify that the resources have been created, use the following command:<br />

asadmin list-jms-resources<br />

<strong>The</strong> output looks like this:<br />

jms/Queue<br />

jms/Topic<br />

jms/ConnectionFactory<br />

Command list-jms-resources executed successfully.<br />

Writing Simple JMS Client Applications<br />

Compiling and Packaging the Clients for the Synchronous Receive<br />

Example<br />

<strong>The</strong> simplest way to run these examples using the Application Server is to package each one in<br />

an application client JAR file. <strong>The</strong> application client JAR file requires a manifest file, located in<br />

the src/conf directory for each example, along with the .class file.<br />

<strong>The</strong> build.xml file for each example contains Ant targets that compile and package the<br />

example. <strong>The</strong> targets place the .class file for the example in the build/jar directory. <strong>The</strong>n the<br />

targets use the jar command to package the class file and the manifest file in an application<br />

client JAR file.<br />

To compile and package the Producer and SynchConsumer examples using NetBeans IDE,<br />

follow these steps:<br />

1. In NetBeans IDE, choose Open Project from the File menu.<br />

2. In the Open Project dialog, navigate to<br />

tut-install/javaeetutorial5/examples/jms/simple/.<br />

3. Select the producer folder.<br />

4. Select the Open as Main Project check box.<br />

5. Click Open Project.<br />

6. Right-click the project and choose Build.<br />

7. In NetBeans IDE, choose Open Project from the File menu.<br />

Chapter 31 • <strong>The</strong> <strong>Java</strong> Message Service API 911

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

Saved successfully!

Ooh no, something went wrong!