sproutsocial / nsq-j

Java client for the NSQ realtime distributed messaging platform
MIT License
73 stars 25 forks source link

LIS-9781: Introduce SubscriptionId for unique subscription identifiers #82

Closed blakesmith closed 3 months ago

blakesmith commented 3 months ago

Previously, we introduced the Subscriber#unsubscribe(String topic, String channel) call.

This method is unfortunately not correct if we create more than one subscription to the same topic, with the same channel, which is possible with the current client.

We would get in a situation where the unsubscribe call would unsubscribe from whatever subscription was created first.

This change:

  1. Changes Subscriber#subscribe to return a unique SubscriptionId for each subscription. This method previously returned void, so should not be a breaking change.
  2. Deprecates the old Subscriber#unsubscribe(String topic, String channel) call.
  3. Replaces the call with a new Subscriber#unsubscribe(SubscriptionId).

Tests: Unit.