Components of the JMS Architecture

   

Components of the JMS Architecture

The typical JMS architecture is made up of several components. Each component plays a pivotal role in allowing producers and consumers to communicate with one another. The following components are the ones that most often are used in a JMS component architecture:

  • Message producers

  • Message consumers

  • JMS messages

  • Administered JMS objects

  • JNDI naming service

Figure 10.2 shows how these components are structured in a typical JMS architecture.

Figure 10.2. A typical JMS architecture uses several components to produce and consume messages.

graphics/10fig02.gif

You must understand each major component in the architecture. The next sections describe how each component is used in the JMS architecture.

Message Producers

A message producer is a component in the application that is responsible for creating a message that needs to be delivered to a destination. As you learned from the previous section, "What Is Message-Oriented Middleware?," a message can be a notification that a system error has occurred, an e-mail message, or some other type of application event. The message content is entirely up to the application. An application can have several message producers. Each producer might be responsible for creating different types of messages and sending them to different destinations. The destination for each producer might be the same or different.

Message Consumers

A message consumer is a component that resides on the receiving end of a messaging application. Its responsibility is to listen for messages and process the message when it arrives. Just as with producers, a JMS application can have more than one consumer processing or consuming messages. A message may have information contained within it that a consumer can use to determine whether the consumer is interested in the message. You'll see more on message selection in the section "Message Selection and Filtering," later in this chapter.

The JMS Message

The message is the component that contains the information that must be communicated to another application or component. It could be raw data, state about the system, or a Java object. The data is wrapped by a JMS Message object, which serves as sort of a container for the data that is being transferred from one component to another.

Administered JMS Objects

When a producer is ready to send a message off to a consumer, the message doesn't go directly to the consumer. The producer will deliver the message to a particular destination. This destination normally is set up during application deployment or configuration and is initialized when the application is started. You'll learn more about how to set up the administered objects later in this chapter and in the examples.

Naming Service

For a producer and consumer to be able to use the administered objects to send and receive messages, they must know how to locate things such as the destination. Location of a destination and other administrative components is done through a naming service. In the case of J2EE, this is done through JNDI. For a producer or consumer to locate a JMS administrative component, they must perform a lookup on the name of the component it wants to locate.

For more information on locating components through JNDI, see Chapter 4, "Java Naming and Directory Interface."



Special Edition Using Enterprise JavaBeans 2.0
Special Edition Using Enterprise JavaBeans 2.0
ISBN: 0789725673
EAN: 2147483647
Year: 2000
Pages: 223

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net