Details
Description
I have two consumers, having a durable subscription on a topic. If I send a persistent message to the topic, everything works ok. However, when I restart the consumers, one of them receives the message again after connecting (it seems to be the one that ACK's the message as second). Reconnecting again doesn't give any problems, the messages aren't redelivered.
This problem does not happen when only a single consumer is connected. Also, it doesn't appear if the persistent message is sent before the consumers are connected.
Steps to reproduce:
Start two consumers with a durable topic subscription (in the example/ directory):
$ ant consumer -Ddurable=true -DclientId=test1 -Dtopic=true
$ ant consumer -Ddurable=true -DclientId=test2 -Dtopic=true
Send persistent messages to this topic:
$ ant producer -Ddurable=true -Dtopic=true
Kill consumers and start them again. One of them willl receive each message again.
This also happens if I use the STOMP protocol. In ActiveMQ 4.1.1 things work as expected, but in snapshots (I tried 4.2 and 5.0), the behaviour is as above.