Point-to-Point Messaging PublishSubscribe Messaging

Understanding WebLogic JMS 2-3

2.1.3.1 Major Components

The major components of the WebLogic JMS Server architecture, as illustrated in Figure 2–2 , include: ■ JMS servers that can host a defined set of modules and any associated persistent storage that reside on a WebLogic Server instance. ■ JMS modules contains configuration resources such as queues, topics, and connections factories and are defined by XML documents that conform to the http:xmlns.oracle.comweblogicweblogic-jms1.0weblogic-jm s.xsd schema. ■ Client JMS applications that either produce messages to destinations or consume messages from destinations. ■ JNDI Java Naming and Directory Interface, which provides a resource lookup facility. JMS resources such as connection factories and destinations are configured with a JNDI name. The runtime implementations of these resources are then bound into JNDI using the given names. ■ WebLogic persistent storage file store or JDBC-accessible for storing persistent message data.

2.2 Understanding the Messaging Models

JMS supports two messaging models: point-to-point PTP and publishsubscribe pubsub. The messaging models are very similar, except for the following differences: ■ PTP messaging model enables the delivery of a message to exactly one recipient. ■ Pubsub messaging model enables the delivery of a message to multiple recipients. Each model is implemented with classes that extend common base classes. For example, the PTP class javax.jms.Queue described at http:java.sun.comjavaee5docsapijavaxjmsQueue.html and the pubsub class javax.jms.Topic described at http:java.sun.comjavaee5docsapijavaxjmsTopic.html both extend the class javax.jms.Destination described at http:java.sun.comjavaee5docsapijavaxjmsDestination.html . Each message model is described in detail in the following sections.

2.2.1 Point-to-Point Messaging

The point-to-point PTP messaging model enables one application to send a message to another. PTP messaging applications send and receive messages using named queues. A queue sender producer sends a message to a specific queue. A queue receiver consumer receives messages from a specific queue. The following figure illustrates PTP messaging. Note: The terms producer and consumer are used as generic descriptions of applications that send and receive messages, respectively, in either messaging model. For each specific messaging model, however, unique terms specific to that model are used when referring to producers and consumers. 2-4 Programming JMS for Oracle WebLogic Server Figure 2–3 Point-to-Point PTP Messaging Multiple queue senders and queue receivers can be associated with a single queue, but an individual message can be delivered to only one queue receiver. If multiple queue receivers are listening for messages on a queue, WebLogic JMS determines which one will receive the next message on a first come, first serve basis. If no queue receivers are listening on the queue, messages remain in the queue until a queue receiver attaches to the queue.

2.2.2 PublishSubscribe Messaging

The publishsubscribe pubsub messaging model enables an application to send a message to multiple applications. Pubsub messaging applications send and receive messages by subscribing to a topic. A topic publisher producer sends messages to a specific topic. A topic subscriber consumer retrieves messages from a specific topic. The following figure illustrates pubsub messaging. Figure 2–4 PublishSubscribe PubSub Messaging Unlike with the PTP messaging model, the pubsub messaging model allows multiple topic subscribers to receive the same message. JMS retains the message until all topic subscribers have received it. The PubSub messaging model supports durable subscribers, allowing you to assign a name to a topic subscriber and associate it with a user or application. For more information about durable subscribers, see Section 6.7, Setting Up Durable Subscriptions.

2.2.3 Message Persistence