Chapter 23 876 Multiple JMS consumers may subscribe to the same topic. Topics are also known as subjects, groups or channels. A newsgroup has a Pub/Sub configuration, that is, a person posts a message to a particular topic and zero or more people (message consumers) who are interested in the topic will read the message. However, the poster (the message producer) does not know who reads the messages. Generally in a Pub/Sub configuration both publishers and subscribers are anonymous. The Point-to-Point (PTP) messaging model uses queues as its messaging destination. Like topics, queues are configured and stored in a JNDI namespace and clients do a JNDI lookup to find a particular queue. In the PTP model a client that receives messages has one or more queues. A client sending a message sends the message directly to the intended receiver's queue. The message stays in that queue until the message consumer retrieves it. An e-mail system is PTP, that is, a person sends a message directly to another person. The sender (the message producer) knows that only the recipient (the message consumer) will read the message. In JMS there is no method for sending a message to a particular list of consumers. The Pub/Sub model allows the producer to send the message to a group of consumers, but the producer doesn't specify the recipient list; it is the consumers who decide whether or not to subscribe to the topic. Administered Objects Administered objects are objects pre-configured and stored by JMS administrators for the use of JMS clients. These objects are stored in JNDI as described above. The implementation classes for administered objects are required to implement java.io.Serializable and javax.naming.Referencable so that they can be stored in the standard JNDI naming context. Configuration of Administered objects is usually vendor-specific, so check your JMS product's documentation to see how to configure them on your system. Administered objects contain the configuration information required by JMS clients for connecting to the JMS provider, local addressing information for message destinations, etc. JMS providers normally provide tools for creating, configuring, and storing administered objects. Two kinds of administered objects are defined in JMS: q Connection factories are administered objects used by JMS clients for creating connections to a JMS provider q Destinations are objects used by JMS clients to specify the locations to and from which they send and receive messages The Publish/Subscribe Messaging Model Pub/Sub is a one-to-many messaging model. One message producer publishes a message to a topic and many message consumers subscribe to that topic and receive the message. More than one publisher may publish to the same topic, so Pub/Sub could also be considered a many-to-many messaging model: