Who Should Use This Book
Before You Read This Book
How This Book Is Organized
Documentation Conventions
Related Documentation
Setting Up Your Environment
Starting and Testing a Message Broker
To Start a Broker
To Test a Broker
Developing a Client Application
To Produce Messages
To Consume Messages
Compiling and Running a Client Application
To Compile and Run the HelloWorldMessage Application
Deploying a Client Application
Example Application Code
Client Design Considerations
Developing Portable Clients
Choosing which JMS API to Use
Connections and Sessions
JMSContext
Producers and Consumers
Assigning Client Identifiers
Message Order and Priority
Using Selectors Efficiently
Balancing Reliability and Performance
Managing Client Threads
JMS Threading Restrictions
Thread Allocation for Connections
Managing Memory and Resources
Managing Memory
Managing Message Size
Message Compression
Advantages and Limitations of Compression
Compression Examples
Managing the Dead Message Queue
Managing Physical Destination Limits
Programming Issues for Message Consumers
Using the Client Runtime Ping Feature
Preventing Message Loss for Synchronous Consumers
Synchronous Consumption in Distributed Applications
Factors Affecting Performance
Delivery Mode (Persistent/Nonpersistent)
Use of Transactions
Acknowledgment Mode
Durable vs. Nondurable Subscriptions
Use of Selectors (Message Filtering)
Message Size
Message Body Type
Connection Event Notification
Connection Events
Creating an Event Listener
Event Listener Examples
Consumer Event Notification
Consumer Events
Creating a Consumer Event Listener
Consumer Event Listener Examples
Client Connection Failover (Auto-Reconnect)
Enabling Auto-Reconnect
Single-Broker Auto-Reconnect
Parallel Broker Auto-Reconnect
Clustered-Broker Auto-Reconnect
Auto-Reconnect Behaviors
Auto-Reconnect Limitations
Handling Exceptions When Failover Occurs
Handling Exceptions in a Transacted Session
Handling Exceptions in a Non-Transacted Session
Custom Client Acknowledgment
Using Client Acknowledge Mode
Using No Acknowledge Mode
Schema Validation of XML Payload Messages
Communicating with C Clients
Client Runtime Logging
Logging Name Spaces, Levels, and Activities
Using the JRE Logging Configuration File
Using a Logging Configuration File for a Specific Application
Setting the Logging Configuration Programmatically
Using the Simplified API
Using the Autocloseable Interface
Simplified Extraction of Message Bodies
Developing a JMS Client using the Simplified API
Working With Connections
Working With Destinations
Working With Messages
Message Structure
Message Headers
Changes for Standard JMS 2.0 Message Properties
Sending Messages
Simplified API methods for Asynchronous Sends
Receiving Messages
Using Shared Non-durable Subscriptions
Using Shared Durable Subscriptions
Starting Message Delivery
Processing Messages
Retrieving Message Header Fields
Messaging Domains
Obtaining a Connection Factory
Looking Up a Connection Factory With JNDI
Overriding Configuration Settings
Instantiating a Connection Factory
Using Connections
Creating Secure Connections (SSL)
Looking Up a Destination With JNDI
To Look Up a Destination With JNDI
Instantiating a Destination
Temporary Destinations
Working With Sessions
Acknowledgment Modes
Transacted Sessions
Message Header
Message Properties
Message Body
Composing Messages
Composing Text Messages
Composing Stream Messages
Composing Map Messages
Composing Object Messages
Composing Bytes Messages
Asynchronous send
Creating Message Consumers
Receiving Messages Synchronously
Receiving Messages Asynchronously
Acknowledging Messages
Browsing Messages
Closing a Consumer
Retrieving Message Properties
Processing the Message Body
Monitoring Overview
Administrative Tasks
Implementation Summary
To Implement Message-Based Monitoring
Creating a Metrics-Monitoring Client
To Monitor Broker Metrics
Format of Metrics Messages
Broker Metrics
JVM Metrics
Destination-List Metrics
Destination Metrics
Metrics Monitoring Client Code Examples
A Broker Metrics Example
A Destination List Metrics Example
A Destination Metrics Example
What is SOAP?
SOAP with Attachments API for Java
The Transport Layer
The SOAP Layer
The Language Implementation Layer
The Profiles Layer
Interoperability
The SOAP Message
SOAP Packaging Models
SOAP Messaging in JAVA
The SOAP Message Object
Inherited Methods
Namespaces
Destination, Message Factory, and Connection Objects
Endpoint
Message Factory
Connection
SOAP Connection
SOAP Messaging Models and Examples
SOAP Messaging Programming Models
Working with Attachments
To Create and Add an Attachment
Exception and Fault Handling
Writing a SOAP Client
To Write a SOAP Client for Point-to-Point Messaging
Writing a SOAP Service
Disassembling Messages
Handling Attachments
Replying to Messages
Handling SOAP Faults
Integrating SOAP and Message Queue
Example 1: Deferring SOAP Processing
To Transform the SOAP Message into a JMS Message and Send the JMS Message
To Receive the JMS Message, Transform it into a SOAP Message, and Process It
Example 2: Publishing SOAP Messages
Code Samples
Creating, Initializing and Starting an Embedded Broker
Creating a Broker Event Listener
Arguments to Specify When Initializing an Embedded Broker
Creating a Direct Connection to an Embedded Broker
Creating a TCP Connection to an Embedded Broker
Stopping and Shutting Down an Embedded Broker
Embedded Broker Example
Warning Messages and Error Codes