Cover image for Java message service API tutorial and reference : messagimg for the J2EE platform
Title:
Java message service API tutorial and reference : messagimg for the J2EE platform
Publication Information:
Boston : Addison-Wesley, 2002
ISBN:
9780201784725
Added Author:

Available:*

Library
Item Barcode
Call Number
Material Type
Item Category 1
Status
Searching...
30000010052981 QA76.73.J38 J385 2002 Open Access Book Book
Searching...

On Order

Summary

Summary

This is a guide to a diverse range of window treatments. Each of the more than 100 ideas - several of which are no-sew - can easily be accomplished in less than two hours. The authors dispense professional advice on what makes a window treatment successful, and show how to salvage old favourites, incorporate special hardware and use natural light. And of course there is information on fabrics, tassels, ties and more.


Author Notes

Mark Hapner is Lead Architect for the Java 2 Platform, Enterprise Edition. He participated in the development of the JDBC API, wrote the Java Message Service specification, and co-authored the Enterprise JavaBeans specification.

Rich Burridge is a Staff Engineer at Sun Microsystems, where he has worked for over fifteen years. Currently with the Accessibility group, he is the creator of the Java Shared Data Toolkit (JSDT) and a coauthor of the Java Message Service API specification. Previously he worked on the "Netscape 6 for Solaris," OpenStep, and OpenWindows products.

Rahul Sharma is the lead architect of the J2EE Connector architecture and a Senior Staff Engineer at the Java Software division of Sun Microsystems, Inc. Presently, he is the lead architect of the JAX-RPC (Java APIs for XML based RPC) 1.0. Rahul has been with Sun for the last five years. Rahul holds a computer engineering degree from the Delhi University, India, and an MBA from the Haas School of Business, UC Berkeley.

Joseph Fialli is a Senior Staff Engineer at Sun Microsystems, where he has worked for the past four years. Currently, he is the lead architect for the Java Architecture for XML Binding (JAXB). Previously, he was the technical lead for the Java Message Service API within the J2EE Software Development Kit, version1.3, and maintained Java serialization within the Java 2 Platform, Standard Edition, version 1.2.

Kim Haase is a staff writer with Sun Microsystems, where she documents the J2EE platform. In previous positions she has documented compilers, debuggers, and floating-point programming. She currently writes about the Java Message Service and J2EE SDK tools.




Excerpts

Excerpts

The Java™ Message Service Tutorial and Reference provides an introduction to the Java Message Service (JMS) API for new users. It has the following goals: To introduce the JMS API to new users, with simple JMS client program examples To show how to use the JMS API within the Java 2 Platform, Enterprise Edition (J2EE™ platform), with additional simple examples showing how to Consume messages asynchronously with a message-driven bean Produce messages from an application client Produce messages from a session bean Access an entity bean from a message-driven bean Produce and consume messages on more than one system To provide a full reference to the JMS API for JMS client programmers The audience for this book is programmers who expect to write JMS applications, especially applications for the J2EE platform ("J2EE applications") that use the JMS API. We assume that you are familiar with the Java programming language and that you have some experience with earlier versions of the J2EE platform. In order to run the tutorial examples, we recommend that you download and install the Java 2 Software Development Kit, Enterprise Edition (J2EE SDK), version 1.3 or above, which is available at no charge and runs on the Solaris™ Operating Environment and on the Linux and Windows NT/2000 operating systems. See http://java.sun.com/j2ee/ for more information and a link to the J2EE SDK. You should first install the required version of the Java 2 Software Development Kit, Standard Edition (J2SE™ SDK), if it is not already installed. You can download the examples in this book, along with an HTML version of the tutorial, from the following location: http://java.sun.com/products/jms/tutorial/. The downloaded examples are in a directory named jms_tutorial/examples (on UNIX(R) systems) or jms_tutorial\examples (on Microsoft Windows systems). You may adapt the examples to other implementations of the JMS API and the J2EE platform, but you will need to study your vendor's documentation to determine how to modify the parts of the examples and instructions that deal with external resources, such as JMS administered objects (connection factories and destinations) and databases. For the J2EE platform examples, you will also need to adapt the instructions to use your vendor's packaging and deployment tools. Part Two, the reference, is based on the API documentation for JMS version 1.0.2b. The reference describes all parts of the API that apply to JMS application programmers. It does not describe the methods and interfaces that are used only for implementing a JMS provider. This book uses a few simple documentation conventions: Monospace fontis used for code, which includes what would be typed in a source code file or on the command line, URLs, file names, keywords, and names of classes, interfaces, exceptions, constructors, methods, and fields. Italic code font is used for variables in text, command lines, and method explanations. Italic font is used for introducing new terms, for book titles, and for emphasis. We welcome your comments, questions, and suggestions. Please send them to the following e-mail address: jms-book@sun.com. Errata for this book and information on other books in the Addison-Wesley Java series will be posted at http://java.sun.com/Series. 0201784726P02132002 Excerpted from Java Message Service API Tutorial and Reference: Messaging for the J2EE Platform by Richard Burridge, Rahul Sharma, Joseph Fialli, Kim Haase, Mark Hapner All rights reserved by the original copyright owners. Excerpts are provided for display purposes only and may not be reproduced, reprinted or distributed without the written permission of the publisher.

Table of Contents

Prefacep. xvii
Acknowledgmentsp. xix
About the Authorsp. xxi
Part 1

p. 1

1 Overviewp. 3
1.1 What Is Messaging?p. 3
1.2 What Is the JMS API?p. 4
1.3 When Can You Use the JMS API?p. 5
1.4 How Does the JMS API Work with the J2EE Platform?p. 6
2 Basic JMS API Conceptsp. 9
2.1 JMS API Architecturep. 9
2.2 Messaging Domainsp. 10
2.2.1 Point-to-Point Messaging Domainp. 11
2.2.2 Publish/Subscribe Messaging Domainp. 11
2.3 Message Consumptionp. 13
3 The JMS API Programming Modelp. 15
3.1 Administered Objectsp. 16
3.1.1 Connection Factoriesp. 17
3.1.2 Destinationsp. 18
3.2 Connectionsp. 18
3.3 Sessionsp. 19
3.4 Message Producersp. 20
3.5 Message Consumersp. 21
3.5.1 Message Listenersp. 22
3.5.2 Message Selectorsp. 23
3.6 Messagesp. 23
3.6.1 Message Headersp. 23
3.6.2 Message Propertiesp. 24
3.6.3 Message Bodiesp. 25
3.7 Exception Handlingp. 26
4 Writing Simple JMS Client Applicationsp. 27
4.1 Setting Your Environment for Running Applicationsp. 28
4.2 A Simple Point-to-Point Examplep. 29
4.2.1 Writing the PTP Client Programsp. 29
4.2.2 Compiling the PTP Clientsp. 37
4.2.3 Starting the JMS Providerp. 37
4.2.4 Creating the JMS Administered Objectsp. 37
4.2.5 Running the PTP Clientsp. 38
4.2.6 Deleting the Queuep. 39
4.3 A Simple Publish/Subscribe Examplep. 39
4.3.1 Writing the Pub/Sub Client Programsp. 39
4.3.2 Compiling the Pub/Sub Clientsp. 48
4.3.3 Starting the JMS Providerp. 48
4.3.4 Creating the JMS Administered Objectsp. 49
4.3.5 Running the Pub/Sub Clientsp. 49
4.3.6 Deleting the Topic and Stopping the Serverp. 50
4.4 Running JMS Client Programs on Multiple Systemsp. 51
4.4.1 Communicating Between Two J2EE Serversp. 51
4.4.2 Communicating Between a J2EE Server and a System Not Running a J2EE Serverp. 52
5 Creating Robust JMS Applicationsp. 55
5.1 Using Basic Reliability Mechanismsp. 56
5.1.1 Controlling Message Acknowledgmentp. 56
5.1.2 Specifying Message Persistencep. 58
5.1.3 Setting Message Priority Levelsp. 59
5.1.4 Allowing Messages to Expirep. 59
5.1.5 Creating Temporary Destinationsp. 60
5.2 Using Advanced Reliability Mechanismsp. 60
5.2.1 Creating Durable Subscriptionsp. 61
5.2.2 Using JMS API Local Transactionsp. 64
6 Using the JMS API in a J2EE Applicationp. 67
6.1 Using Enterprise Beans to Produce and to Synchronously Receive Messagesp. 67
6.1.1 Administered Objectsp. 68
6.1.2 Resource Managementp. 68
6.1.3 Transactionsp. 69
6.2 Using Message-Driven Beansp. 69
6.3 Managing Distributed Transactionsp. 71
6.4 Using the JMS API with Application Clients and Web Componentsp. 74
7 A Simple J2EE Application that Uses the JMS APIp. 75
7.1 Writing and Compiling the Application Componentsp. 76
7.1.1 Coding the Application Client: SimpleClient.javap. 77
7.1.2 Coding the Message-Driven Bean: MessageBean.javap. 79
7.1.3 Compiling the Source Filesp. 82
7.2 Creating and Packaging the Applicationp. 82
7.2.1 Starting the J2EE Server and the Deploytoolp. 83
7.2.2 Creating a Queuep. 83
7.2.3 Creating the J2EE Applicationp. 84
7.2.4 Packaging the Application Clientp. 84
7.2.5 Packaging the Message-Driven Beanp. 87
7.2.6 Checking the JNDI Namesp. 90
7.3 Deploying and Running the Applicationp. 90
7.3.1 Looking at the Deployment Descriptorp. 91
7.3.2 Adding the Serverp. 93
7.3.3 Deploying the Applicationp. 93
7.3.4 Running the Clientp. 94
7.3.5 Undeploying the Applicationp. 95
7.3.6 Removing the Application and Stopping the Serverp. 95
8 A J2EE Application that Uses the JMS API with a Session Beanp. 97
8.1 Writing and Compiling the Application Componentsp. 98
8.1.1 Coding the Application Client: MyAppClient.javap. 99
8.1.2 Coding the Publisher Session Beanp. 100
8.1.3 Coding the Message-Driven Bean: MessageBean.javap. 106
8.1.4 Compiling the Source Filesp. 108
8.2 Creating and Packaging the Applicationp. 109
8.2.1 Starting the J2EE Server and the Deploytoolp. 109
8.2.2 Creating a Topicp. 110
8.2.3 Creating a Connection Factoryp. 110
8.2.4 Creating the J2EE Applicationp. 111
8.2.5 Packaging the Application Clientp. 111
8.2.6 Packaging the Session Beanp. 113
8.2.7 Packaging the Message-Driven Beanp. 115
8.2.8 Specifying the JNDI Namesp. 117
8.3 Deploying and Running the Applicationp. 118
8.3.1 Adding the Serverp. 118
8.3.2 Deploying the Applicationp. 119
8.3.3 Running the Clientp. 119
8.3.4 Undeploying the Applicationp. 120
8.3.5 Removing the Application and Stopping the Serverp. 120
9 A J2EE Application that Uses the JMS API with an Entity Beanp. 123
9.1 Overview of the Human Resources Applicationp. 124
9.2 Writing and Compiling the Application Componentsp. 125
9.2.1 Coding the Application Client: HumanResourceClient.javap. 126
9.2.2 Coding the Message-Driven Beansp. 132
9.2.3 Coding the Entity Beanp. 145
9.2.4 Compiling the Source Filesp. 155
9.3 Creating and Packaging the Applicationp. 155
9.3.1 Starting the J2EE Server and the Deploytoolp. 156
9.3.2 Creating a Queuep. 156
9.3.3 Starting the Cloudscape Database Serverp. 157
9.3.4 Creating the J2EE Applicationp. 157
9.3.5 Packaging the Application Clientp. 157
9.3.6 Packaging the Equipment Message-Driven Beanp. 160
9.3.7 Packaging the Office Message-Driven Beanp. 163
9.3.8 Packaging the Schedule Message-Driven Beanp. 165
9.3.9 Packaging the Entity Beanp. 167
9.3.10 Specifying the Entity Bean Deployment Settingsp. 169
9.3.11 Specifying the JNDI Namesp. 170
9.4 Deploying and Running the Applicationp. 171
9.4.1 Adding the Serverp. 171
9.4.2 Deploying the Applicationp. 172
9.4.3 Running the Clientp. 172
9.4.4 Undeploying the Applicationp. 173
9.4.5 Removing the Application and Stopping the Serverp. 173
10 An Application Example that Uses Two J2EE Serversp. 175
10.1 Overview of the Applicationsp. 176
10.2 Writing and Compiling the Application Componentsp. 177
10.2.1 Coding the Application Client: MultiAppServerRequester.javap. 177
10.2.2 Coding the Message-Driven Bean: ReplyMsgBean.javap. 184
10.2.3 Compiling the Source Filesp. 188
10.3 Creating and Packaging the Applicationp. 188
10.3.1 Starting the J2EE Servers and the Deploytoolp. 189
10.3.2 Creating a Connection Factoryp. 189
10.3.3 Creating the First J2EE Applicationp. 190
10.3.4 Packaging the Application Clientp. 191
10.3.5 Creating the Second J2EE Applicationp. 194
10.3.6 Packaging the Message-Driven Beanp. 194
10.3.7 Checking the JNDI Namesp. 197
10.4 Deploying and Running the Applicationsp. 198
10.4.1 Adding the Serverp. 198
10.4.2 Deploying the Applicationsp. 199
10.4.3 Running the Clientp. 200
10.4.4 Undeploying the Applicationsp. 200
10.4.5 Removing the Applications and Stopping the Serversp. 201
10.5 Accessing a J2EE Application from a Remote System that Is Not Running a J2EE Serverp. 201
10.5.1 Accessing a J2EE Application from a Standalone Clientp. 201
10.5.2 Using runclient to Access a Remote Application Clientp. 208
Part 2

p. 209

11 BytesMessagep. 211
11.1 Overview and Related Methods and Interfacesp. 211
11.2 Interface Definitionp. 212
11.3 Methodsp. 213
12 Connectionp. 225
12.1 Overview and Related Interfacesp. 225
12.2 Interface Definitionp. 226
12.3 Methodsp. 227
13 ConnectionFactoryp. 233
13.1 Overview and Related Interfacesp. 233
13.2 Interface Definitionp. 234
14 ConnectionMetaDatap. 235
14.1 Overviewp. 235
14.2 Interface Definitionp. 235
14.3 Methodsp. 236
15 DeliveryModep. 239
15.1 Overviewp. 239
15.2 Interface Definitionp. 239
15.3 Fieldsp. 240
16 Destinationp. 241
16.1 Overview and Related Interfacesp. 241
16.2 Interface Definitionp. 242
17 ExceptionListenerp. 243
17.1 Overview and Related Methodp. 243
17.2 Interface Definitionp. 243
17.3 Methodsp. 244
18 IllegalStateExceptionp. 245
18.1 Overviewp. 245
18.2 Class Definitionp. 245
18.3 Constructorsp. 246
19 InvalidClientIDExceptionp. 247
19.1 Overviewp. 247
19.2 Class Definitionp. 247
19.3 Constructorsp. 248
20 InvalidDestinationExceptionp. 249
20.1 Overviewp. 249
20.2 Class Definitionp. 249
20.3 Constructorsp. 250
21 InvalidSelectorExceptionp. 251
21.1 Overviewp. 251
21.2 Class Definitionp. 251
21.3 Constructorsp. 252
22 JMSExceptionp. 253
22.1 Overviewp. 253
22.2 Class Definitionp. 254
22.3 Constructorsp. 254
22.4 Methodsp. 255
23 JMSSecurityExceptionp. 257
23.1 Overviewp. 257
23.2 Class Definitionp. 257
23.3 Constructorsp. 258
24 MapMessagep. 259
24.1 Overview and Related Methods and Interfacesp. 259
24.2 Interface Definitionp. 261
24.3 Methodsp. 261
25 Messagep. 273
25.1 Overviewp. 273
25.1.1 Message Bodiesp. 274
25.1.2 Message Headersp. 275
25.1.3 Message Propertiesp. 275
25.1.4 Provider Implementations of JMS Message Interfacesp. 277
25.1.5 Message Selectorsp. 278
25.1.6 Related Methods and Interfacesp. 283
25.2 Interface Definitionp. 284
25.3 Fieldsp. 285
25.4 Methodsp. 286
26 MessageConsumerp. 309
26.1 Overview and Related Interfacesp. 309
26.2 Interface Definitionp. 310
26.3 Methodsp. 310
27 MessageEOFExceptionp. 315
27.1 Overviewp. 315
27.2 Class Definitionp. 315
27.3 Constructorsp. 316
28 MessageFormatExceptionp. 317
28.1 Overviewp. 317
28.2 Class Definitionp. 317
28.3 Constructorsp. 318
29 MessageListenerp. 319
29.1 Overviewp. 319
29.2 Interface Definitionp. 319
29.3 Methodsp. 320
30 MessageNotReadableExceptionp. 321
30.1 Overviewp. 321
30.2 Class Definitionp. 321
30.3 Constructorsp. 322
31 MessageNotWriteableExceptionp. 323
31.1 Overviewp. 323
31.2 Class Definitionp. 323
31.3 Constructorsp. 324
32 MessageProducerp. 325
32.1 Overview and Related Interfacesp. 325
32.2 Interface Definitionp. 326
32.3 Methodsp. 326
33 ObjectMessagep. 333
33.1 Overview and Related Methods and Interfacesp. 333
33.2 Interface Definitionp. 334
33.3 Methodsp. 334
34 Queuep. 337
34.1 Overview and Related Methods and Interfacesp. 337
34.2 Interface Definitionp. 337
34.3 Methodsp. 338
35 QueueBrowserp. 339
35.1 Overview and Related Methods and Interfacesp. 339
35.2 Interface Definitionp. 339
35.3 Methodsp. 340
36 QueueConnectionp. 343
36.1 Overview and Related Interfacesp. 343
36.2 Interface Definitionp. 343
36.3 Methodsp. 343
37 QueueConnectionFactoryp. 345
37.1 Overview and Related Interfacesp. 345
37.2 Interface Definitionp. 345
37.3 Methodsp. 345
38 QueueReceiverp. 347
38.1 Overview and Related Methods and Interfacesp. 347
38.2 Interface Definitionp. 347
38.3 Methodsp. 348
39 QueueRequestorp. 349
39.1 Overview and Related Interfacesp. 349
39.2 Class Definitionp. 349
39.3 Constructorp. 350
39.4 Methodsp. 350
40 QueueSenderp. 353
40.1 Overview and Related Methods and Interfacesp. 353
40.2 Interface Definitionp. 354
40.3 Methodsp. 354
41 QueueSessionp. 359
41.1 Overview and Related Methods and Interfacesp. 359
41.2 Interface Definitionp. 359
41.3 Methodsp. 360
42 ResourceAllocationExceptionp. 365
42.1 Overviewp. 365
42.2 Class Definitionp. 365
42.3 Constructorsp. 366
43 Sessionp. 367
43.1 Overview and Related Interfacesp. 367
43.2 Interface Definitionp. 369
43.3 Fieldsp. 370
43.4 Methodsp. 371
44 StreamMessagep. 377
44.1 Overview and Related Methods and Interfacesp. 377
44.2 Interface Definitionp. 379
44.3 Methodsp. 380
45 TemporaryQueuep. 391
45.1 Overview and Related Methods and Interfacesp. 391
45.2 Interface Definitionp. 391
45.3 Methodsp. 391
46 TemporaryTopicp. 393
46.1 Overview and Related Methods and Interfacesp. 393
46.2 Interface Definitionp. 393
46.3 Methodsp. 393
47 TextMessagep. 395
47.1 Overview and Related Methods and Interfacesp. 395
47.2 Interface Definitionp. 396
47.3 Methodsp. 396
48 Topicp. 397
48.1 Overview and Related Methods and Interfacesp. 397
48.2 Interface Definitionp. 397
48.3 Methodsp. 398
49 TopicConnectionp. 399
49.1 Overview and Related Interfacesp. 399
49.2 Interface Definitionp. 399
49.3 Methodsp. 399
50 TopicConnectionFactoryp. 401
50.1 Overview and Related Interfacesp. 401
50.2 Interface Definitionp. 401
50.3 Methodsp. 401
51 TopicPublisherp. 403
51.1 Overview and Related Methodp. 403
51.2 Interface Definitionp. 404
51.3 Methodsp. 404
52 TopicRequestorp. 409
52.1 Overview and Related Interfacep. 409
52.2 Class Definitionp. 409
52.3 Constructorp. 410
52.4 Methodsp. 410
53 TopicSessionp. 413
53.1 Overview and Related Methods and Interfacesp. 413
53.2 Interface Definitionp. 413
53.3 Methodsp. 414
54 TopicSubscriberp. 421
54.1 Overview and Related Methods and Interfacesp. 421
54.2 Interface Definitionp. 422
54.3 Methodsp. 422
55 TransactionInProgressExceptionp. 425
55.1 Overviewp. 425
55.2 Class Definitionp. 425
55.3 Constructorsp. 426
56 TransactionRolledBackExceptionp. 427
56.1 Overviewp. 427
56.2 Class Definitionp. 427
56.3 Constructorsp. 428
Appendix A JMS Client Examplesp. 429
A.1 Durable Subscriptionsp. 429
A.2 Transactionsp. 439
A.3 Acknowledgment Modesp. 464
A.4 Utility Classp. 478
Glossaryp. 487
Indexp. 495