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 (message producers) and objects that receive messages (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, where it is retrieved by one or more message consumers. JMS defines two types of destinations, corresponding to two basic forms of messaging:
Topic: A destination used in publish/subscribe messaging. If a topic has several subscribed listeners, each message published to that topic is delivered to all listeners.
Queue: 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.