Share E-Book
Scan to open this page

Scan with your phone to open this page

Author: Richard Monson-Haefel, David Chappell

Rating No ratings yet

This book is a thorough introduction to Java Message Service (JMS) from Sun Microsystems. It shows how to build applications using the point-to-point and publish-andsubscribe models; use features like transactions and durable subscriptions to make applications reliable; and use messaging within Enterprise JavaBeans. It also introduces a new EJB type, the MessageDrivenBean, that is part of EJB 2.0, and discusses integration of messaging into J2EE.

AI Reading Assistant

Whole-book reading guide from stratified index samples; jump to passages in the text

AI guide
【One-Line Pitch】 A practical, example-driven guide to building reliable asynchronous Java systems with JMS, covering both messaging models, message anatomy, transactions, and integration with EJB, Spring, and Java EE. Best for Java developers and architects who need to design or maintain enterprise messaging rather than just call an API. 【Book Arc】 - **Opening (~0%–10%)**: Frames why messaging exists — decoupling, architectural agility, event-driven architecture, and heterogeneous platform integration — and contrasts asynchronous messaging with blocking RPC. Solves the "why should I care?" problem before any code. - **Early (~10%–32%)**: Introduces the JMS API and its two programming models, then walks through a complete publish-and-subscribe chat client, including JNDI lookups and connection setup. Solves the "how do I get a first working client?" problem. - **Middle (~32%–55%)**: Dissects the JMS message itself — headers, properties, and payload types — and then develops point-to-point messaging through a borrower/lender application, covering correlation, dynamic queues, load balancing, and queue browsing. - **Late (~55%–80%)**: Extends into publish-and-subscribe refinements (durable, nondurable, and dynamic durable subscribers, temporary topics), message filtering with selectors, and reliability features such as transactions and dead message queues. - **Ending (~80%–100%)**: Moves to integration and design: message-driven beans in Java EE/EJB 3.0, Spring's JmsTemplate and message-driven POJOs, and a closing discussion of messaging design considerations and anti-patterns. 【Key Takeaways】 - **Messaging buys decoupling and agility at the cost of complexity** (Early): producers need not know a consumer's language, platform, location, or protocol, which makes systems easier to swap and evolve — but architects must consciously decide where asynchrony is worth it. - **Point-to-point and publish-and-subscribe are distinct tools, not interchangeable** (Middle): p2p queues suit load-balanced work distribution, while pub/sub topics broadcast events to many unknown subscribers; the book builds both from the same borrower/lender scenario to make the contrast concrete. - **The message is the contract** (Middle): headers, properties, and payload each play a role, and understanding automatically assigned versus developer-assigned headers prevents subtle delivery and correlation bugs. - **Reliability is a design choice, not a default** (Late): durable subscriptions, transactions, and dead message queues are the mechanisms that keep messages from being lost when consumers are offline or processing fails. - **Message selectors push filtering to the consumer side** (Late): they let subscribers receive only relevant messages, which matters as topic traffic grows. - **Java EE integration centers on the message-driven bean** (Ending): MDBs let messaging participate in the container's concurrency, scalability, and lifecycle management rather than being hand-rolled. - **Spring lowers the JMS boilerplate barrier** (Ending): JmsTemplate, message conversion, and message-driven POJOs offer a lighter alternative to raw JMS or EJB for many applications. - **Anti-patterns are as important as patterns** (Ending): the book closes by naming common messaging design mistakes, signaling that successful messaging is an architecture discipline, not just an API skill. 【Reading Tips】 - Read Chapters 1–2 quickly for orientation, then slow down on the message anatomy and p2p/pub-sub chapters — those are the conceptual core you will return to. - Treat the code walkthroughs as templates: type or adapt the chat and borrower/lender examples rather than reading them passively. - If you already use Spring or Java EE, jump to the MDB and Spring chapters first, then backfill the messaging fundamentals. - Pay special attention to the reliability material (transactions, durable subscriptions, dead message queues) — this is where production incidents usually originate. - Keep the anti-patterns chapter as a checklist to revisit when reviewing a real messaging design. 【Coverage Limits】 This guide is based on stratified excerpts covering the preface, table of contents, and selected early-to-middle chapters; the excerpts do not cover the full text of later chapters on transactions, MDBs, Spring, or anti-patterns in detail, so those sections are summarized from chapter listings and framing rather than deep content.
Page 6
ceiving Messages Synchronously 195 Message-Driven POJOs 198 The Spring Message Listener Container 198 MDP Option 1: Using the MessageListener Interface 199 M...
View in text
Excerpt 2
age. For example, suppose a message is published to a topic every time an exception occurs in a Java application. The responsibility of the publisher is to s...
View in text
Excerpt 3
connection.close(); } /* Run the Chat Client */ public static void main(String [] args) { try { if (args.length!=3) System.out.println("Factory, Topic, or us...
View in text
Excerpt 4
he developer using the setJMS<HEADER>() methods are ignored. In other words, for most headers that are au- tomatically assigned, using the mutator methods ex...
View in text
Excerpt 5
request/reply processing. With fire-and-forget processing, the message producer sends a message to a queue and does not expect to receive a response (at leas...
View in text
Excerpt 6
ender class needs to send the response back to the borrower. It does this by first creating a JMS message to send. The response message does not need to be t...
View in text
Excerpt 7
on of how messages are associated with durable subscribers. 102 | Chapter 5: Publish-and-Subscribe Messaging System.out.println("\nWaiting for rate updates.....
View in text
Excerpt 8
damental differences between the two filtering ap- proaches. One key factor to consider with the Multiple Destination approach is whether the message produce...
View in text
Tags
AI categories
JavaBackendSoftware
ISBN: 0596000685
Publisher: O'Reilly
Publish Year: 2001
Language: English
Pages: 184
File Format: PDF
File Size: 1.9 MB
Text Preview (First 20 pages)
Registered users can read the full content for free

Register as a Gaohf Library member to read the complete e-book online for free and enjoy a better reading experience.

Generating text preview…