0

From official doc

At the cost of higher overhead, you can use the Session.createDurableSubscriber method to create a durable subscriber. A durable subscription can have only one active subscriber at a time

Can you explain why design was chosen so?

From my point of view topic was invebted especially for situation when we have a lot of subscribers.

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
gstackoverflow
  • 36,709
  • 117
  • 359
  • 710

1 Answers1

1

A topic can have any number of subscribers, durable and non-durable. Each subscriber will get a copy of the message published. So you need to create lot of subscriptions when you have lot of subscribers.

If there are more than one subscribers sharing the same subscription, then publications will be distributed among them. So only one of the subscriber will get the publication, not all.

A durable subscription is one where publications are sent to the subscriber's queue even if the subscribing application is offline. Those messages are delivered once the application comes online.

Shashi
  • 14,980
  • 2
  • 33
  • 52
  • what the subscriber's queue ? – gstackoverflow Aug 23 '17 at 09:36
  • A subscribers queue is queue to which messaging provider puts publications into. Subscribers gets the publications from the queue. Typically messaging providers automatically create the subscriber queue when a subscription is created. It's also possible for application to provide a subscriber queue name. – Shashi Aug 23 '17 at 11:14
  • Is it truth that message broker(same as message provider if I understand you correct) puts message into 2 places: topic queue and into subscription queue associated with same topic? – gstackoverflow Aug 23 '17 at 11:35
  • I am not aware of a topic queue. As far as I know there is only subscription queue. – Shashi Aug 23 '17 at 11:54
  • jms api has 2 methods: 1.session.createDurableSubscriber(topic) 2. session.createConsumer(topic) – gstackoverflow Aug 23 '17 at 11:58
  • Both the cause of creation subscription queue? – gstackoverflow Aug 23 '17 at 11:59
  • Yes. However in case of createConsumer, the subscription queue is deleted by the messaging provider after the application closes connection(normally or abnormally) to messaging provider. – Shashi Aug 23 '17 at 15:25
  • I can have several active subscriptions with 1 subscriber for each only? but I can have only one active subscriber for single subscription? – gstackoverflow Aug 23 '17 at 16:45