Java Message Service, Second Edition, is a thorough introduction to the standard API that supports "messaging" -- the software-to-software exchange of crucial data among network computers. You'll learn how JMS can help you solve many architectural challenges, such as integrating dissimilar systems and applications, increasing scalability, eliminating system bottlenecks, supporting concurrent processing, and promoting flexibility and agility.


See more details below
Java Message Service

Available on NOOK devices and apps  
  • NOOK Devices
  • Samsung Galaxy Tab 4 NOOK 7.0
  • Samsung Galaxy Tab 4 NOOK 10.1
  • NOOK HD Tablet
  • NOOK HD+ Tablet
  • NOOK eReaders
  • NOOK Color
  • NOOK Tablet
  • Tablet/Phone
  • NOOK for Windows 8 Tablet
  • NOOK for iOS
  • NOOK for Android
  • NOOK Kids for iPad
  • PC/Mac
  • NOOK for Windows 8
  • NOOK for PC
  • NOOK for Mac
  • NOOK for Web

Want a NOOK? Explore Now

NOOK Book (eBook)
BN.com price
(Save 43%)$31.99 List Price


Java Message Service, Second Edition, is a thorough introduction to the standard API that supports "messaging" -- the software-to-software exchange of crucial data among network computers. You'll learn how JMS can help you solve many architectural challenges, such as integrating dissimilar systems and applications, increasing scalability, eliminating system bottlenecks, supporting concurrent processing, and promoting flexibility and agility.

Updated for JMS 1.1, this second edition also explains how this vendor-agnostic specification will help you write messaging-based applications using IBM's MQ, Progress Software's SonicMQ, ActiveMQ, and many other proprietary messaging services.

With Java Message Service, you will:

  • Build applications using point-to-point and publish-and-subscribe messaging models
  • Use features such as transactions and durable subscriptions to make an application reliable
  • Implement messaging within Enterprise JavaBeans (EJB) using message-driven beans
  • Use JMS with RESTful applications and with the Spring application framework

Messaging is a powerful paradigm that makes it easier to uncouple different parts of an enterprise application. Java Message Service, Second Edition, will quickly teach you how to use the key technology that lies behind it.

This book is a thorough introduction to Java Message Service (JMS), the standard Java application program interface (API) that supports the formal communication known as "messaging" between computers in a network. JMS provides a common interface to standard messaging protocols and to special messaging services in support of Java programs.

Read More Show Less

Product Details

  • ISBN-13: 9780596555603
  • Publisher: O'Reilly Media, Incorporated
  • Publication date: 5/19/2009
  • Sold by: Barnes & Noble
  • Format: eBook
  • Edition number: 2
  • Pages: 330
  • File size: 4 MB

Meet the Author

Richard Monson-Haefel is a leading expert in Enterprise Java development. He is the architect of OpenEJB, an open source EJB server, and has consulted as an architect on Enterprise JavaBeans, CORBA, Java RMI, and other distributed computing projects over the past several years. Richard is also the author of O'Reilly's Enterprise JavaBeans.

Dave Chappell is vice president and SonicMQ chief technology evangelist at Progress Software Corp. Dave has over 18 years of industry experience building software tools and infrastructure for application developers, spanning all aspects of R&D, sales, marketing, and support services. Dave has also been published in Network World magazine and has presented technical topics at numerous speaking engagements including JavaOne and XMLOne.

As director of engineering for SonicMQ, Progress Software's award winning JMS Internet Commerce Messaging System, Dave oversaw the design and development of the fastest and most scalable, reliable, and robust implementation of JMS in the marketplace.

Dave has under his belt a broad cross-platform background in designing and developing Internet based middleware and distributed object systems across a wide range of technologies including C++, Java, DCOM, CORBA, and EJB. Dave's experience also includes development of client/server infrastructure, graphical user interfaces, language interpreters, and various utility libraries.

Read More Show Less

Table of Contents

Foreword xi

Preface xiii

1 Messaging Basics 1

The Advantages of Messaging 3

Heterogeneous Integration 3

Reduce System Bottlenecks 3

Increase Scalability 4

Increase End User Productivity 4

Architecture Flexibility and Agility 5

Enterprise Messaging 5

Centralized Architectures 7

Decentralized Architectures 7

Hybrid Architectures 8

Centralized Architecture As a Model 8

Messaging Models 9

Point-to-Point 10

Publish-and-Subscribe 10


Point-to-Point API 13

Publish-and-Subscribe API 14

Real-World Scenarios 14

Service-Oriented Architecture 15

Event-Driven Architecture 16

Heterogeneous Platform Integration 16

Enterprise Application Integration 17

Business-to-Business 17

Geographic Dispersion 18

Information Broadcasting 18

Building Dynamic Systems 18

RPC Versus Asynchronous Messaging 21

Tightly Coupled RPC 21

Enterprise Messaging 23

2 Developing a Simple Example 25

The Chat Application 25

Getting Started with the Chat Example 28

Examining the Source Code 30

Sessions and Threading 39

3 Anatomy of a JMS Message 41

Headers 42

Automatically Assigned Headers 43

Developer-Assigned Headers 46

Properties 47

Application-Specific Properties 47

JMS-Defined Properties 49

Provider-Specific Properties 50

Message Types 50

Message 50

TextMessage 51

ObjectMessage 52

BytesMessage 53

StreamMessage 56

MapMessage 58

Read-Only Messages 60

Client-Acknowledged Messages 61

Interoperability and Portability of Messages 61

4 Point-to-Point Messaging 63

Point-to-Point Overview 63

When to Use Point-to-Point Messaging 66

The QBorrower and QLender Application 67

Configuring and Running the Application67

The QBorrower Class 69

The QLender Class 76

Message Correlation 81

Dynamic Versus Administered Queues 83

Load Balancing Using Multiple Receivers 84

Examining a Queue 85

5 Publish-and-Subscribe Messaging 87

Publish-and-Subscribe Overview 87

When to Use Publish-and-Subscribe Messaging 89

The TBorrower and TLender Application 90

Configuring and Running the Application 90

The TLender Class 92

The TBorrower Class 96

Durable Versus Nondurable Subscribers 100

Dynamic Versus Administered Subscribers 101

Unsubscribing Dynamic Durable Subscribers 104

Temporary Topics 104

6 Message Filtering 107

Message Selectors 109

Identifiers 110

Literals 111

Comparison Operators 111

Arithmetic Operators 113

Declaring a Message Selector 114

Message Selector Examples 116

Managing Claims in an HMO 116

Notification of Certain Bids on Inventory 116

Priority Handling 116

Stock Trade Order Auditing 117

Not Delivered Semantics 117

Design Considerations 118

7 Guaranteed Messaging and Transactions 125

Guaranteed Messaging 125

Message Autonomy 126

Store-and-Forward Messaging 126

Message Acknowledgments and Failure Conditions 126

Message Acknowledgments 127




Message Groups and Acknowledgment 133

Handling Redelivery of Messages in an Application 134

Message Groups Example 134

Message Grouping and Multiple Receivers 143

Transacted Messages 145

Creating and Using a JMS Transaction 147

Transacted Session Example 147

Distributed Transactions 150

Lost Connections 151

The ExceptionListener Example 152

Dead Message Queues 153

8 Java EE and Message-Driven Beans 155

Java EE Overview 155

Enterprise JavaBeans 156

Enterprise JavaBeans 3.0 (EJB3) Overview 157

Simplified Bean Development 158

Dependency Injection 158

Simplified Callback Methods 159

Programmatic Defaults 159

Interceptors 160

Java Persistence API 162

JMS Resources in Java EE 162

The JNDI Environment Naming Context (ENC) 164

Message-Driven Beans 166

Concurrent Processing and Scalability 168

Defining Message-Driven Beans 168

Message-Driven Bean Use Cases 171

Message Facade 171

Transformation and Routing 173

9 Spring and JMS 177

Spring Messaging Architecture 177

JmsTemplate Overview 180

Send Methods 181

convertAndSend Methods 181

receive and receiveSelected Methods 182

receiveAndConvert Methods 183

Connection Factories and JMS Destinations 184

Using JNDI 184

Using Native Classes 187

Sending Messages 189

Using the send Method 190

Using the convertAndSend Method 191

Using a Nondefault JMS Destination 193

Receiving Messages Synchronously 195

Message-Driven POJOs 198

The Spring Message Listener Container 198

MDP Option 1: Using the MessageListener Interface 199

MDP Option 2: Using the SessionAwareMessageListener Interface 201

MDP Option 3: Using the MessageListenerAdapter 202

Message Conversion Limitations 207

The Spring JMS Namespace 208

<jms:listener-container> Element Properties 209

<jms:listener> Element Properties 211

10 Deployment Considerations 213

Performance, Scalability, and Reliability 213

Determining Message Throughput Requirements 213

Testing the Real-World Scenario 214

To Multicast or Not to Multicast 217

TCP/IP 218

UDP 218

IP Multicast 218

Messaging Over IP Multicast 219

The Bottom Line 221

Security 222

Authentication 222

Authorization 223

Secure Communication 224

Firewalls and HTTP Tunneling 224

Connecting to the Outside World 225

Bridging to Other Messaging Systems 227

11 Messaging Design Considerations 229

Internal Versus External Destination 229

Internal Destination Topology 230

External Destination Topology 231

Request/Reply Messaging Design 232

Messaging Design Anti-Patterns 236

Single-Purpose Queue 236

Message Priority Overuse 240

Message Header Misuse 240

A The Java Message Service API 245

B Message Headers 265

C Message Properties 277

D Installing and Configuring ActiveMQ 285

Index 291

Read More Show Less

Customer Reviews

Be the first to write a review
( 0 )
Rating Distribution

5 Star


4 Star


3 Star


2 Star


1 Star


Your Rating:

Your Name: Create a Pen Name or

Barnes & Noble.com Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & Noble.com that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & Noble.com does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at BN.com or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation


  • - By submitting a review, you grant to Barnes & Noble.com and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Noble.com Terms of Use.
  • - Barnes & Noble.com reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & Noble.com also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on BN.com. It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously

    If you find inappropriate content, please report it to Barnes & Noble
    Why is this product inappropriate?
    Comments (optional)