activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Neil." <>
Subject Losing Messages With a Durable Subscriber
Date Fri, 07 Apr 2006 11:16:49 GMT


I'm trying to test a fairly simple JMS publish/subscribe application using
ActiveMQ 4 with the in-built DerbyDB for queue persistence.

I'm firing up a broker and then starting three subscribers, each listening
to a different topic.

Next I launch a test program that publishes 3 messages, one to each topic.

This works fine and the messages are being received. If I then run the test
program again, the messages are again found and successfully processed.

The problem seems to occur if I launch multiple instances of the test
program at the same time, meaning there are several messages on each topic
at once.  At this point I'm getting some really weird behaviour.  The first
few messages are picked up, but then the consumers start to report that they
aren't finding any messages.

Stopping and restarting the broker means that more messages will be picked
up before the consumers again say that they can't find any messages.
Repeating this process a few times will eventually get all of the messages,
but that probably won't work too well in a production set up! 

There doesn't seem to be any pattern to which messages it's finding; 
sometimes it will get all of the topic 1 messages, one of the topic 2
messages, none of the topic 3 messages... Next time through it will be a
different combination.  The only consistent thing seems to be that it never
finds all of the messages.

If I switch to using session.createConsumer() instead of
session.createDurableSubscriber then everything works fine. Unfortunately I
need the level of resilience provided by persistent messages, so I need to
find a way around this.

Has anybody come across this sort of problem before or are there any silly
mistakes I could be making here?  Any advice would be most welcome, as I'm
pulling my hair out in great clumps a t the moment!

View this message in context:
Sent from the ActiveMQ - Dev forum at

View raw message