Document Information

Preface

Part I Introduction

1.  Overview

2.  Using the Tutorial Examples

Part II The Web Tier

3.  Getting Started with Web Applications

4.  Java Servlet Technology

5.  JavaServer Pages Technology

6.  JavaServer Pages Documents

7.  JavaServer Pages Standard Tag Library

8.  Custom Tags in JSP Pages

9.  Scripting in JSP Pages

10.  JavaServer Faces Technology

11.  Using JavaServer Faces Technology in JSP Pages

12.  Developing with JavaServer Faces Technology

13.  Creating Custom UI Components

14.  Configuring JavaServer Faces Applications

15.  Internationalizing and Localizing Web Applications

Part III Web Services

16.  Building Web Services with JAX-WS

17.  Binding between XML Schema and Java Classes

18.  Streaming API for XML

19.  SOAP with Attachments API for Java

Part IV Enterprise Beans

20.  Enterprise Beans

21.  Getting Started with Enterprise Beans

22.  Session Bean Examples

23.  A Message-Driven Bean Example

Part V Persistence

24.  Introduction to the Java Persistence API

25.  Persistence in the Web Tier

26.  Persistence in the EJB Tier

27.  The Java Persistence Query Language

Part VI Services

28.  Introduction to Security in the Java EE Platform

29.  Securing Java EE Applications

30.  Securing Web Applications

31.  The Java Message Service API

A Java EE Application That Uses the JMS API with a Session Bean

Writing the Application Components for the clientsessionmdb Example

Coding the Application Client: MyAppClient.java

Coding the Publisher Session Bean

Coding the Message-Driven Bean: MessageBean.java

Creating Resources for the clientsessionmdb Example

Building, Deploying, and Running the clientsessionmdb Example Using NetBeans IDE

Building, Deploying, and Running the clientsessionmdb Example Using Ant

A Java EE Application That Uses the JMS API with an Entity

Overview of the clientmdbentity Example Application

Writing the Application Components for the clientmdbentity Example

Coding the Application Client: HumanResourceClient.java

Coding the Message-Driven Beans for the clientmdbentity Example

Coding the Entity Class for the clientmdbentity Example

Creating Resources for the clientmdbentity Example

Building, Deploying, and Running the clientmdbentity Example Using NetBeans IDE

Building, Deploying, and Running the clientmdbentity Example Using Ant

An Application Example That Consumes Messages from a Remote Server

Overview of the consumeremote Example Modules

Writing the Module Components for the consumeremote Example

Creating Resources for the consumeremote Example

Using Two Application Servers for the consumeremote Example

Building, Deploying, and Running the consumeremoteModules Using NetBeans IDE

Building, Deploying, and Running the consumeremote Modules Using Ant

An Application Example That Deploys a Message-Driven Bean on Two Servers

Overview of the sendremote Example Modules

Writing the Module Components for the sendremote Example

Coding the Application Client: MultiAppServerClient.java

Coding the Message-Driven Bean: ReplyMsgBean.java

Creating Resources for the sendremote Example

Using Two Application Servers for the sendremote Example

Building, Deploying, and Running the sendremote Modules Using NetBeans IDE

Building, Deploying, and Running the sendremote Modules Using Ant

33.  Transactions

34.  Resource Connections

35.  Connector Architecture

Part VII Case Studies

36.  The Coffee Break Application

37.  The Duke's Bank Application

Part VIII Appendixes

A.  Java Encoding Schemes

B.  About the Authors

Index

 

Chapter 32

Java EE Examples Using the JMS API

This chapter provides examples that show how to use the JMS API within a Java EE application in the following ways:

  • Using a session bean to send messages that are consumed by a message-driven bean using a message selector and a durable subscription

  • Using an application client to send messages that are consumed by two message-driven beans; the information from them is stored in a Java Persistence API entity

  • Using an application client to send messages that are consumed by a message-driven bean on a remote server

  • Using an application client to send messages that are consumed by message-driven beans on two different servers

The examples are in the following directory:

tut-install/javaeetutorial5/examples/jms/

To build and run the examples, you will do the following:

  1. Use NetBeans IDE or the Ant tool to compile and package the example.

  2. Use the Ant tool to create resources.

  3. Use NetBeans IDE or the Ant tool to deploy the example.

  4. Use NetBeans IDE or the Ant tool to run the client.

Each example has a build.xml file that refers to files in the following directory:

tut-install/javaeetutorial5/examples/bp-project/

See Chapter 23, A Message-Driven Bean Example for a simpler example of a Java EE application that uses the JMS API.