0

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?

atx
  • 266
  • 3
  • 15

1 Answers1

2

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.

Dag
  • 10,079
  • 8
  • 51
  • 74
  • Maybe i wasn't clear about my question, but what i really wanted to know is: in a scenario where topics are involved and listener are available, messages don't disappear if the consumer/listener takes longer to to process the message, than it takes thw producer to generate one. The topic message get "queued" i wanted to know where i can look up how many messages are queued for a specific consumer via JMS. – atx Aug 27 '14 at 07:26
  • Hm, I don't know Geronimo well, but it uses ActiveMQ. Did you checked the JMX resource, possibly it is the "inflight count"? http://activemq.apache.org/how-do-i-find-the-size-of-a-queue.html and http://activemq.apache.org/jmx.html – Dag Aug 27 '14 at 11:44