As discussed above, a critical architectural feature of JMS is that it decouples the objects that send messages from those that receive messages. This architecture contrasts, for example, with the JavaBean event model, where an event listener must register with the object that fires the event. In the JMS messaging model, objects that send messages (called message producers) and objects that receive messages (called message consumers) do not need to be aware of each other, because a producer does not send messages directly to a consumer.
Instead, a JMS message producer sends a message to a destination, from which it is then retrieved by one or more message consumers. JMS defines two types of destinations, corresponding to two basic forms of messaging:
A topic is a destination used in publish/subscribe messaging. If a topic has several subscribed listeners, then each message published to that topic is delivered to all of the listeners.
A queue is a destination used for point-to-point messaging. If a queue has several subscribed receivers, each message is delivered to only one of the receivers. A different receiver might be chosen for each message, possibly depending on some load balancing mechanism.