Sun Java System Message Queue 4.1 Technical Overview

Administered Objects

The JMS specification created a standard that combined many elements of existing MOM systems without attempting to exhaust all possibilities. Rather, it sought to set up an extensible scheme that could accommodate differences and future growth. JMS leaves a number of messaging elements up to the individual providers to define and implement. These include load balancing, standard error messages, administrative APIs, security, the underlying wire protocols, and message stores. The next section, Message Queue: Elements and Features describes how Message Queue implements many of these elements and how it extends the JMS specification.

Two messaging elements that JMS does not completely define are connection factories and destinations. Although these are fundamental elements in the JMS programming model, there were so many existing and anticipated differences in the ways providers define and manage these objects, that it was neither possible nor desirable to create a common definition. Therefore, these two objects, rather than being created programmatically, are normally created and configured using administration tools. They are then stored in an object store, and accessed by a JMS client through standard JNDI lookups.

JMS clients are not required to look up administered objects; they can create these objects programmatically (which are then stored in the broker’s memory). For quick prototyping, creating these objects programmatically might be easiest. But for deployment in a production environment, looking up administered objects in a central repository makes it much easier to control and manage messaging behavior:

The use of administered objects adds a final wrinkle to the picture of the basic JMS application, which is shown in Figure 1–5.

Figure 1–5 Basic Elements of a JMS Application

Producers and consumers using administered objects to
find destinations. Figure explained in text.

Figure 1–5 shows how a message producer and a message consumer use a destination administered object to access the physical destination to which it corresponds. The marked steps denote the actions that need to be taken by the administrator and by the client applications to send and receive messages using this mechanism.

ProcedureTo Use Administered Objects as Destinations

  1. The administrator creates a physical destination on the broker.

  2. The administrator creates a destination administered object and configures it by specifying the name of the physical destination to which it corresponds and its type: queue or topic.

  3. The message producer looks up the destination administered object using a JNDI lookup call.

  4. The message producer sends a message to the destination.

  5. The message consumer looks up the destination administered object where it expects to get messages.

  6. The message consumer gets the message from the destination.

    The process of using connection factory administered objects is similar. The administrator creates and configures a connection factory administered object using administration tools. The client looks up the connection factory object and uses it to create a connection.

    Although the use of administered objects adds a couple of steps to the messaging process, it also adds robustness and portability to messaging applications.