Shared durable subscription

Posted by memento13 on 03-Nov-2011 09:06

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

All Replies

Posted by pmeadows on 03-Nov-2011 09:39

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()).

Posted by memento13 on 03-Nov-2011 10:24

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)?

Posted by pmeadows on 03-Nov-2011 10:42

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.

This thread is closed