Question

If i post a bunch of messages to a topic where the subscriber is very slow. The "Queue Size" in geronimos " JMS Resources" tab stays 0. If I use a JMS Queue instead of the topic, I can see the size growing. In both scenarios all messages are delivered.

Why does the "Queue Size" of the topic shows always 0?

Was it helpful?

Solution

A topic represents the publish-subscribe model, and messages will disappear when no subscriber is listening. Therefor a query on the topic size is always zero.

Topics can have multiple subscribers, so a message can be read on multiple clients "listening" on that topic.

Queues on the other hand will keep the messages until a client asks for the next message. Here you can query for the size of the currently held amount of messages. A message can be picked up only by one client.

See also the Basic JMS API concepts by Oracle.

Described for ideal circumstances, durable topics as well as temporary queues are not considered here.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top