{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

jms_tutorial-1_3_1 JavaTM Message Service Tutorial

jms_tutorial-1_3_1 JavaTM Message Service Tutorial - Java...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon
Java Message Service API Tutorial by Kim Haase Sun Microsystems, Inc.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Copyright 2002 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California 94303 U.S.A. All rights reserved. Sun Microsystems, Inc. has intellectual property rights relating to technology embodied in the product that is described in this document. In particular, and without limitation, these intellectual property rights may include one or more of the U.S. patents listed at http://www.sun.com/patents and one or more addi- tional patents or pending patent applications in the U.S. and in other countries. This document and the product to which it pertains are distributed under licenses restricting their use, copying, distribution, and decompilation. No part of the product or of this document may be reproduced in any form by any means without prior written authorization of Sun and its licensors, if any. Unless otherwise licensed, software code in all technical materials herein (including articles, FAQs, samples) is provided under this License: http://developer.java.sun.com/berkeley_license.html. Third-party software, including font technology, is copyrighted and licensed from Sun suppliers. Sun, Sun Microsystems, the Sun logo, Java, the Java Coffee Cup logo, J2EE, J2SE, Java Naming and Directory Interface, Enterprise JavaBeans, EJB, JavaServer Pages, and JSP are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and other countries. UNIX is a registered trademark in the United States and other countries, exclusively licensed through X/Open Company, Ltd. DOCUMENTATION IS PROVIDED "AS IS" AND ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR FOR A PARTICULAR PURPOSE OR NON-INFRINGE- MENT, ARE DISCLAIMED, EXCEPT TO THE EXTENT THAT SUCH DISCLAIMERS ARE HELD TO BE LEGALLY INVALID.
Background image of page 2
Contents iii 1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 1.1 What Is Messaging? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 1.2 What Is the JMS API? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 1.3 When Can You Use the JMS API?. . . . . . . . . . . . . . . . . . . . . . . . . . . 11 1.4 How Does the JMS API Work with the J2EE Platform?. . . . . . . . . 12 2 Basic JMS API Concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 2.1 JMS API Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 2.2 Messaging Domains . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 2.2.1 Point-to-Point Messaging Domain. . . . . . . . . . . . . . . . . . . . 17 2.2.2 Publish/Subscribe Messaging Domain . . . . . . . . . . . . . . . . 17 2.3 Message Consumption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 3 The JMS API Programming Model . . . . . . . . . . . . . . . . . . . . . . . . . . 21 3.1 Administered Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 3.1.1 Connection Factories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 3.1.2 Destinations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 3.2 Connections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 3.3 Sessions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 3.4 Message Producers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 3.5 Message Consumers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 3.5.1 Message Listeners . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 3.5.2 Message Selectors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 3.6 Messages. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 3.6.1 Message Headers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 3.6.2 Message Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 3.6.3 Message Bodies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 3.7 Exception Handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
iv 4 Writing Simple JMS Client Applications . . . . . . . . . . . . . . . . . . . . . 33 4.1 Setting Your Environment for Running Applications . . . . . . . . . . . . 34 4.2 A Simple Point-to-Point Example . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 4.2.1 Writing the PTP Client Programs . . . . . . . . . . . . . . . . . . . . 35 4.2.2 Compiling the PTP Clients . . . . . . . . . . . . . . . . . . . . . . . . . 43 4.2.3 Starting the JMS Provider . . . . . . . . . . . . . . . . . . . . . . . . . . 43 4.2.4 Creating the JMS Administered Objects . . . . . . . . . . . . . . . 43 4.2.5 Running the PTP Clients . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 4.2.6 Deleting the Queue . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 4.3 A Simple Publish/Subscribe Example . . . . . . . . . . . . . . . . . . . . . . . . 45 4.3.1 Writing the Pub/Sub Client Programs . . . . . . . . . . . . . . . . . 45 4.3.2 Compiling the Pub/Sub Clients . . . . . . . . . . . . . . . . . . . . . . 54 4.3.3 Starting the JMS Provider . . . . . . . . . . . . . . . . . . . . . . . . . . 54 4.3.4 Creating the JMS Administered Objects . . . . . . . . . . . . . . . 55
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}