Skip Headers
Oracle GlassFish Server Message Queue Developer's Guide for Java Clients
Release 4.5.2
Part Number E24945-01
Home
Book List
Contact Us
Next
View PDF
Contents
Title and Copyright Information
Preface
Who Should Use This Book
Before You Read This Book
How This Book Is Organized
Documentation Conventions
Related Documentation
Documentation, Support, and Training
Documentation Accessibility
1
Overview
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
2
Using the Java API
Messaging Domains
Working With Connections
Obtaining a Connection Factory
Looking Up a Connection Factory With JNDI
Overriding Configuration Settings
Instantiating a Connection Factory
Using Connections
Creating Secure Connctions (SSL)
Working With Destinations
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
Working With Messages
Message Structure
Message Header
Message Properties
Message Body
Composing Messages
Composing Text Messages
Composing Stream Messages
Composing Map Messages
Composing Object Messages
Composing Bytes Messages
Sending Messages
Receiving Messages
Creating Message Consumers
Receiving Messages Synchronously
Receiving Messages Asynchronously
Acknowledging Messages
Browsing Messages
Closing a Consumer
Processing Messages
Retrieving Message Header Fields
Retrieving Message Properties
Processing the Message Body
3
Message Queue Clients: Design and Features
Client Design Considerations
Developing Portable Clients
Choosing Messaging Domains
Connections and Sessions
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
4
Using the Metrics Monitoring API
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
5
Working with SOAP Messages
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
6
Embedding a Message Queue Broker in a Java Client
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
A
Warning Messages and Client Error Codes
Warning Messages and Error Codes