Java Reference
In-Depth Information
A short introduction to JMS
JMS defines a vendor-neutral (but Java-specific) set of programming interfaces to interact
with asynchronous messaging systems. Messaging enables distributed communication that
is loosely coupled. The whole messaging interchange is a two-step process where a com-
ponent sends a message to a destination that is in turn retrieved by the recipient with the
mediation of the JMS server. In JMS, there are two types of destinations: topics and
queues. These have different semantics, which are explained next.
In a point-to-point model, messages are sent from producers to consumers via queues. A
given queue might have multiple receivers, but only one receiver would be able to consume
each of the messages. Only the first receiver who requests the message will get it, while the
others will not, as shown in the following image:
A message sent to a topic , on the other hand, might be received by multiple parties. Mes-
sages published on a specific topic are sent to all the message consumers who have re-
gistered (subscribed) themselves to receive messages on that topic. A subscription can be
durable or nondurable . A nondurable subscriber can only receive messages that are pub-
lished while it is active . A nondurable subscription does not guarantee the delivery of a
message; it might deliver the same message more than once. A durable subscription, on the
other hand, guarantees that the consumer receives the message exactly once, as depicted in
the following image:
As far as message consumption is concerned, even though JMS is inherently asynchronous,
the JMS specification allows messages to be consumed in either of the following two ways:
Search WWH ::

Custom Search