morellon/stomp — Issue #21: should not by default allow duplicate subscribes
Author: ripienaar
Created: 2011-11-09 22:02:44+00:00
State: open

Hello,

I think the behavior with duplicate subscribes is confusing and / or broken.

client.subscribe("/topic/foo")
client.subscribe("/topic/foo")

client.publish("/topic/foo", "hello")
p client.receive.body
p client.receive.body

This gives you two copies of the same message. Now at the most basic I think you should not be able to subscribe twice to the same source without specifically enabling some flag to force this.

Additionally you store subscriptions in @subscriptions and on a later connection attempt you replay the subscriptions this is fine but in the case of dupe subscriptions you will loose the duplicated subscription.

So if you ran the code above followed by:

client.disconnect
client.publish("/topic/foo", "hello")
p client.receive.body
p client.receive.body

You'd now only receive 1 copy of the message as the dupe subscription isnt replayed.