Hi,
In my use case one topic can have several consumers, but one message should be consumed only once, so I'm using shared subscritions and it works has expected.
All consumers can be offline, but messages produced in mean time, should still be consumed after a consumer comes online. So I also must use durable subscriptions.
The problem is that if second consumer makes connection, then it is refused with following exception:
Caused by: [129] progress.message.client.EUserAlreadyConnected: [129] progress.message.client.EUserAlreadyConnected
How should I configure this?
Thanks
I suspect both subscribers are trying to use the same Durable Subscription Name. Make sure they're distinct durable subscriptions with different names. You get the shared subscription behaviour simply by ensuring both subscribers use the same group prefix in the topic name.
So:
Subscriber-1
Durable Name: Sub1
Topic: [[SomeGroup]]MyTopic
Subscriber-2
Durable Name: Sub2
Topic: [[SomeGroup]]MyTopic
Subscriber-n
...
Alternatively you could ensure the clients have distinct Client ID's (ref' ConnectionFactory.setClientID()/Connection.setClientID()).
If I create two subscriptions with distinct names (or set different Client IDs for connections), does that mean that message is delivered twice to both subscribers (when shared subscriptions are used)?
No. Provided each subscriber uses the same group prefix in the topic name then messages will be 'shared' between those subscribers rather than being delivered to all of them.