Java Reference
In-Depth Information
sume each message. The first receiver to fetch the message will get it, while every-
one else will not:
A message sent to a topic , on the other hand, may be received by multiple parties.
Messages published on a specific topic are sent to all message consumers that have
registered (subscribed) to receive messages on that topic. A subscription can be
durable or nondurable . A nondurable subscriber can only receive messages that
are published while it is active . A nondurable subscription does not guarantee the
delivery of the message or may deliver the same message more than once. A dur-
able subscription, on the other hand, guarantees that the consumer receives the
message exactly once:
As far as message consumption is concerned, even though JMS is inherently asyn-
chronous, the JMS specification allows messages to be consumed in either of the
following two ways:
Synchronously : A subscriber or a receiver explicitly fetches the mes-
sage from the destination by calling the receive() method of any Mes-
sageConsumer instance. The receive() method can block until a
message arrives or can time out if a message does not arrive within a
specified time limit.
Asynchronously : With the asynchronous mode, the client must imple-
ment the javax.jms.MessageListener interface and overwrite the
onMessage() method. Whenever a message arrives at the destination,
the JMS provider delivers the message by calling the listener's onMes-
sage method, which acts on the contents of the message.
Search WWH ::




Custom Search