# Overview: Messaging Systems and JMS

This topic describes the characteristics of messaging systems that are accessible via JMS (Java Message Service), and therefore via the WLI JMS control.

To learn about the WLI JMS control, see WLI JMS Control.

To learn about specific messaging scenarios that are supported by the WLI JMS control, see Messaging Scenarios Supported by the WLI JMS Control.

### Messaging Systems

Messaging systems provide communication between software components. A client of a messaging system can send messages to, and receive messages from, any other client. Each client connects to a messaging server that provides facilities for sending and receiving messages. WebLogic JMS, which is a component of WebLogic Server is an example of a messaging server. WebLogic Server also supports third party messaging systems.

Messaging systems provide distributed communication that is asynchronous. A component sends a message to a destination. A message recipient can retrieve messages from a destination. The sender and receiver do not communicate directly. The sender only knows that a destination exists to which it can send messages, and the receiver also knows there is a destination from which it can receive messages. As long as they agree what message format and what destination to use, the messaging system will manage the actual message delivery.

Messaging systems also may provide reliability. The specific level of reliability is typically configurable on a per-destination or per-client basis, but messaging systems are capable of guaranteeing that a message will be delivered, and that it will be delivered to each intended recipient exactly once.

JMS supports two basic styles of message-based communications: point-to-point and publish and subscribe.

### JMS Queues for Point-to-Point Messaging

Point-to-point messaging is accomplished with JMS queues. A queue is a specific named resource that is configured in a JMS server.

A JMS client, of which the WLI JMS control is an example, may send messages to a queue or receive messages from a queue. Point-to-point messages have a single consumer. Multiple receivers may listen for messages on the same queue, but once any receiver retrieves a particular message from the queue that message is consumed and is no longer available to other potential consumers.

A message consumer acknowledges receipt of every message it receives.

The messaging system will continue attempting to resend a particular message until a predetermined number of retries have been attempted.

### JMS Topics for Publish and Subscribe Messaging

Publish and subscribe messaging is accomplished with JMS topics. A topic is a specific named resource that is configured in a JMS server.

A JMS client, of which the WLI JMS control is an example, may publish messages to a topic or subscribe to a topic. Published messages have multiple potential subscribers. All current subscribers to a topic receive all messages published to that topic after the subscription becomes active.

### Connection Factories

Before a JMS client can send or receive messages to a queue or topic, it must obtain a connection to the messaging system. This is accomplished via a connection factory. A connection factory is a resource that is configured by the message server administrator. The names of connection factories are stored in a JNDI directory for lookup by clients wishing to make a connection.

There is a default connection factory pre-configured in WebLogic Workshop, named cgConnectionFactory. This connection factory is used for all WLI JMS controls that do not explicitly override it. If you use a connection factory other than the default connection factory, the factory must have the following setting:

    userTransactionsEnabled="true"

### Message Components

The components of a JMS message are as follows: a set of standard header fields, a set of application-specific properties, and a message body. Every JMS message contains a standard set of header fields that is included by default and available to message consumers. Some fields can be set by the message producers. The property fields of a message contain header fields added by the sending application. The properties are standard Java name/value pairs. A message body contains the content being delivered from producer to consumer. You can manipulate the content of these components using the following annotations:

@jc:jms-headers Annotation

@jc:jms-property Annotation

Related Topics

WLI JMS Control

WLI JMS Control Interface

@jc:jms-headers Annotation

@jc:jms-property Annotation