I'm seeing something strange when I have durable subscribers on a topic with
a selector specified.
I'm using ActiveMQ 5.2.0 and STOMP in production. I'm seeing similar
behavior with a local ActiveMQ built from trunk today (2009-04-16), however.
1) I set up a topic, 'msm.test'.
2) I establish 3 subscribers:
a) subscriber 'msm-test-all' with no selector
b) subscriber 'msm-test-red' with a selector header set to: color =
'red'
c) subscriber 'msm-test-blue' with a selector header set to: color =
'blue'
At this point, I see in the web console's subscriber list:
msm-test-all: pending q 0, dispatched q 0, dispatched 0, enqueued 0,
dequeued 0
msm-test-red: pending q 0, dispatched q 0, dispatched 0, enqueued 0,
dequeued 0
msm-test-blue: pending q 0, dispatched q 0, dispatched 0, enqueued 0,
dequeued 0
3) I have a publisher program that sends 10 messages with a simple body 'foo
#' and a header/property 'color: red' or 'color:blue' alternating (5 each).
At this point, I can go to the web console and see that the three
subscribers have messages waiting:
msm-test-all: pending q 10, dispatched q 0, dispatched 0, enqueued 10,
dequeued 0
msm-test-red: pending q 5, dispatched q 0, dispatched 0, enqueued 5,
dequeued 0
msm-test-blue: pending q 5, dispatched q 0, dispatched 0, enqueued 5,
dequeued 0
4) The first time I run my consumer program for each subscriber, each
successfully receives its messages. The console then reads:
msm-test-all: pending q 0, dispatched q 0, dispatched 10, enqueued 10,
dequeued 10
msm-test-red: pending q 0, dispatched q 0, dispatched 5, enqueued 5,
dequeued 5
msm-test-blue: pending q 0, dispatched q 0, dispatched 5, enqueued 5,
dequeued 5
All good thus far.
5) Then I run my publisher again and send 10 more messages, similar to the
first 10. The console now shows:
msm-test-all: pending q 10, dispatched q 0, dispatched 10, enqueued 20,
dequeued 10
msm-test-red: pending q 5, dispatched q 0, dispatched 5, enqueued 10,
dequeued 5
msm-test-blue: pending q 5, dispatched q 0, dispatched 5, enqueued 10,
dequeued 5
Still good. Then things get odd, to me.
6) I run my consumers again, exactly the same as before. The subscriber
msm-test-all receives its messages as expected. The msm-test-red and
msm-test-blue subscribers never receive their messages. They poll the topic
a set number of times, waiting for messages, and then disconnect. Now the
console reads:
msm-test-all: pending q 0, dispatched q 0, dispatched 20, enqueued 20,
dequeued 20
msm-test-red: pending q 0, dispatched q 0, dispatched 5, enqueued 10,
dequeued 5
msm-test-blue: pending q 0, dispatched q 0, dispatched 5, enqueued 10,
dequeued 5
For my two subscribers with selectors, the messages have disappeared from
the pending queue but they were never dispatched and never dequeued.
The cycle of step 5 and step 6 can be repeated indefinitely. The subscriber
with no selector always receives its messages. The subscribers with
selectors never again receive messages after the first run. They never can
again until I delete the subscribers and start over.
I have noticed if I refresh the console while the subscribers are polling,
the pending queue grows quite a bit for that subscriber (I've seen from 35
to 100 messages in that queue count), but always goes to 0 after the
disconnect.
Additional oddness that may be related:
With ActiveMQ 5.2.0, if I delete the subscribers only and start over, they
all begin to fail the same way when they are recreated. I can only get
things working completely again by deleting the topic. This does not happen
with the ActiveMQ trunk build.
With ActiveMQ 5.2.0 I also notice after a while I start getting a lot of
messages on console:
ERROR RecoveryListenerAdapter - Message id
ID:MSM.local-55265-1239764351925-5:70:-1:1:1 could not be recovered from the
data store - already dispatched
I have not seen this error on ActiveMQ trunk.
Has anyone else seen any behavior like this? Is there anything I am missing
with working with the selectors and subscribers? Is there a known defect
with durable topic subscribers and JMS selectors that I missed in Jira?
I do note that I see no problems with subscribers with selectors and queues.
I appreciate any assistance. Being able to use selectors with topics is
pretty useful for my application. I have been stymied by this behavior for a
while now.
MSM
--
View this message in context: http://www.nabble.com/Oddness-with-durable-subscribers-and-selectors-tp23087573p23087573.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
|