Skip navigation.

Programming WebLogic JMS

   Previous Next vertical dots separating previous/next from contents/index/pdf Contents View as PDF   Get Adobe Reader

Introduction and Roadmap

Document Scope and Audience

Guide to this Document

Related Documentation

Samples and Tutorials for the JMS Developer

Avitek Medical Records Application (MedRec) and Tutorials

JMS Examples in the WebLogic Server Distribution

New and Changed JMS Features In This Release

Understanding WebLogic JMS

Overview of the Java Message Service and WebLogic JMS

What Is the Java Message Service?

Implementation of Java Specifications

J2EE Specification

JMS Specification

WebLogic JMS Architecture

Major Components

Understanding the Messaging Models

Point-to-Point Messaging

Publish/Subscribe Messaging

Message Persistence

Value-Added Public JMS API Extensions

Understanding the JMS API


Using the Default Connection Factories

Configuring and Deploying Connection Factories

The ConnectionFactory Class



WebLogic JMS Session Guidelines

Session Subclasses

Non-Transacted Session

Transacted Session


Distributed Destinations

MessageProducer and MessageConsumer


Message Header Fields

Message Property Fields

Message Body





Best Practices for Application Design

Message Design

Serializing Application Objects

Serializing strings

Server-side serialization


Message Compression

Message Properties and Message Header Fields

Message Ordering

Topics vs. Queues

Asynchronous vs. Synchronous Consumers

Persistent vs. Non-Persistent Messages

Deferring Acknowledges and Commits

Using AUTO_ACK for Non-Durable Subscribers

Alternative Qualities of Service, Multicast and No-Acknowledge



Avoid Multi-threading

Developing a Basic JMS Application

Importing Required Packages

Setting Up a JMS Application

Step 1: Look Up a Connection Factory in JNDI

Step 2: Create a Connection Using the Connection Factory

Create a Queue Connection

Create a Topic Connection

Step 3: Create a Session Using the Connection

Create a Queue Session

Create a Topic Session

Step 4: Look Up a Destination (Queue or Topic)

Using a JNDI Name

Use a Reference

Step 5: Create Message Producers and Message Consumers Using the Session and Destinations

Create QueueSenders and QueueReceivers

Create TopicPublishers and TopicSubscribers

Step 6a: Create the Message Object (Message Producers)

Step 6b: Optionally Register an Asynchronous Message Listener (Message Consumers)

Step 7: Start the Connection

Example: Setting Up a PTP Application

Example: Setting Up a Pub/Sub Application

Sending Messages

Create a Message Object

Define a Message

Send the Message to a Destination

Send a Message Using Queue Sender

Send a Message Using TopicPublisher

Setting Message Producer Attributes

Example: Sending Messages Within a PTP Application

Example: Sending Messages Within a Pub/Sub Application

Receiving Messages

Receiving Messages Asynchronously

Asynchronous Message Pipeline

Receiving Messages Synchronously

Using the Prefetch Mode to Create a Synchronous Message Pipeline

Example: Receiving Messages Synchronously Within a PTP Application

Example: Receiving Messages Synchronously Within a Pub/Sub Application

Recovering Received Messages

Acknowledging Received Messages

Releasing Object Resources

Managing Your Applications

Managing Rolled Back, Recovered, Redelivered, or Expired Messages

Setting a Redelivery Delay for Messages

Setting a Redelivery Delay

Overriding the Redelivery Delay on a Destination

Setting a Redelivery Limit for Messages

Configuring a Message Redelivery Limit On a Destination

Configuring an Error Destination for Undelivered Messages

Ordered Redelivery of Messages

Required Message Pipeline Setting for the Messaging Bridge and MDBs

Performance Limitations

Handling Expired Messages

Setting Message Delivery Times

Setting a Delivery Time on Producers

Setting a Delivery Time on Messages

Overriding a Delivery Time

Interaction With the Time-to-Live Value

Setting a Relative Time-to-Deliver Override

Setting a Scheduled Time-to-Deliver Override

JMS Schedule Interface

Managing Connections

Defining a Connection Exception Listener

Accessing Connection Metadata

Starting, Stopping, and Closing a Connection

Managing Sessions

Defining a Session Exception Listener

Closing a Session

Managing Destinations

Dynamically Creating Destinations

Dynamically Deleting Destinations

Preconditions for Deleting Destinations

What Happens when a Destination is Deleted

Message Timestamps for Troubleshooting Deleted Destinations

Deleted Destination Statistics

Using Temporary Destinations

Creating a Temporary Queue

Creating a Temporary Topic

Deleting a Temporary Destination

Setting Up Durable Subscriptions

Defining the Persistent Store

Defining the Client ID

Creating Subscribers for a Durable Subscription

Deleting Durable Subscriptions

Modifying Durable Subscriptions

Managing Durable Subscriptions

Setting and Browsing Message Header and Property Fields

Setting Message Header Fields

Setting Message Property Fields

Browsing Header and Property Fields

Filtering Messages

Defining Message Selectors Using SQL Statements

Defining XML Message Selectors Using XML Selector Method

Displaying Message Selectors

Indexing Topic Subscriber Message Selectors To Optimize Performance

Sending XML Messages

WebLogic XML APIs

Using a String Representation

Using a DOM Representation

Using JMS Module Helper to Manage Applications

Configuring JMS System Resources Using JMSModuleHelper

Configuring JMS Servers and Store-and-Forward Agents

JMSModuleHelper Sample Code

Creating a JMS System Resource

Deleting a JMS System Resource

Best Practices when Using JMSModuleHelper

Using Multicasting with WebLogic Server

Benefits of using Multicasting

Limitations of using Multicasting

Configuring Multicasting for WebLogic Server

Prerequisites for Multicasting

Step 1: Set Up the JMS Application, Creating Multicast Session and Topic Subscriber

Step 2: Set Up the Message Listener

Dynamically Configuring Multicasting Configuration Attributes

Example: Multicast TTL

Using Distributed Destinations

What is a Distributed Destination?

Why Use a Distributed Destination

Creating a Distributed Destination

Types of Distributed Destinations

Uniform Distributed Destinations

Weighted Distributed Destinations

Using Distributed Destinations

Using Distributed Queues

Queue Forwarding




Using Distributed Topics



Deploying Message-Driven Beans on a Distributed Topic

Accessing Distributed Destination Members

Accessing Uniform Destination Members

Accessing Weighted Destination Members

Distributed Destination Failover

Using Message-Driven Beans with Distributed Destinations

Common Use Cases for Distributed Destinations

Maximizing Production

Maximizing Availability

Using Queues

Using Topics

Stuck Messages

Enhanced J2EE Support for Using WebLogic JMS With EJBs and Servlets

Enabling WebLogic JMS Wrappers

Declaring JMS Objects as Resources In the EJB or Servlet Deployment Descriptors

Declaring a Wrapped JMS Connection Factory

Declaring JMS Destinations

Sending a JMS Message In a J2EE Container

What's Happening Under the JMS Wrapper Covers

Automatically Enlisting Transactions

Container-Managed Security

Connection Testing

J2EE Compliance

Pooled JMS Connection Objects

Improving Performance Through Pooling

Speeding Up JNDI Lookups by Pooling Session Objects

Speeding Up Object Creation Through Caching

Enlisting the Proper Transaction Mode

Examples of JMS Wrapper Functions



Simplified Access to Remote or Foreign JMS Providers

Using Message Unit-of-Order

What Is Message Unit-Of-Order?

Understanding Message Processing with Unit-of-Order

Message Processing According to the JMS Specification

Message Processing with Unit-of-Order

Message Delivery with Unit-of-Order

Message Unit-of-Order Case Study

Joe Orders a book

What Happened to Joe's Order

How Message Unit-of-Order Solves the Problem

How to Create a Unit-of-Order

Creating a Unit-of-Order Programmatically

Creating a Unit-of-Order Administratively

Configuring Unit-of-Order for a Connection Factory

Unit-of-Order Naming Rules

Message Unit-of-Order Advanced Topics

What Happens When a Message Is Delayed During Processing?

What Happens When a Filter Makes a Message Undeliverable

What Happens When Destination Sort Keys are Used

Using Unit-of-Order with Distributed Destinations

Using the Path Service

Using Hash-based Routing

Using Unit-of-Order with Topics

Using Unit-of-Order with JMS Message Management

Using Unit-of-Order with WebLogic Store-and-Forward

Using Unit-of-Order with WebLogic Messaging Bridge

Limitations to Message Unit-of-Order

Using Transactions with WebLogic JMS

Overview of Transactions

Using JMS Transacted Sessions

Step 1: Set Up JMS Application, Creating Transacted Session

Step 2: Perform Desired Operations

Step 3: Commit or Roll Back the JMS Transacted Session

Using JTA User Transactions

Step 1: Set Up JMS Application, Creating Non-Transacted Session

Step 2: Look Up User Transaction in JNDI

Step 3: Start the JTA User Transaction

Step 4: Perform Desired Operations

Step 5: Commit or Roll Back the JTA User Transaction

Asynchronous Messaging Within JTA User Transactions Using Message Driven Beans

Example: JMS and EJB in a JTA User Transaction

WebLogic JMS C API

What Is the WebLogic JMS C API?

System Requirements

WebLogic JMS C API Code Examples

Design Principles

Java Objects Map to Handles

Thread Utilization

Exception Handling

Type Conversions

Integer (int)

Long (long)

Character (char)


Memory Allocation and Garbage Collection

Closing Connections

Helper Functions

Security Considerations

Implementation Guidelines

Recovering from a WebLogic Server Failure

Automatic Failover for JMS Clients

Automatic Failover for JMS Producers

Re-usable Connection Factory Objects

Re-usable Destination Objects

Reconnected Connection Objects

Special Cases for Reconnected Connections

Reconnected Session Objects

Special Cases for Reconnected Sessions

Reconnected Message Producer Objects

Special Case for Reconnected MessageProducers and Distributed Destinations

Limitations for Automatic JMS Client Failover

Turning off Automatic Reconnect Programatically

Best Practices for JMS Clients Using Automatic Failover

Use Transactions to Group Message Work

JMS Clients Should Always Call the close() Method

Programming Considerations for WebLogic Server 9.0 or Earlier Failures

Migrating JMS Data to a New Server

Deprecated WebLogic JMS Features

Defining Server Session Pools

Step 1: Look Up Server Session Pool Factory in JNDI

Step 2: Create a Server Session Pool Using the Server Session Pool Factory

Create a Server Session Pool for Queue Connection Consumers

Create a Server Session Pool for Topic Connection Consumers

Step 3: Create a Connection Consumer

Create a Connection Consumer for Queues

Create a Connection Consumer for Topics

Example: Setting Up a PTP Client Server Session Pool

Example: Setting Up a Pub/Sub Client Server Session Pool

FAQs: Integrating Remote JMS Providers


Skip footer navigation  Back to Top Previous Next