You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2019/03/05 08:02:40 UTC

[GitHub] [pulsar] sijie commented on a change in pull request #3746: [java client] Bugfix prevent dup consumers for same topic subscription

sijie commented on a change in pull request #3746: [java client] Bugfix prevent dup consumers for same topic subscription
URL: https://github.com/apache/pulsar/pull/3746#discussion_r262382559
 
 

 ##########
 File path: pulsar-client/src/main/java/org/apache/pulsar/client/impl/PulsarClientImpl.java
 ##########
 @@ -688,8 +688,10 @@ public void reloadLookUp() throws PulsarClientException {
     private <T> Optional<ConsumerBase<T>> subscriptionExist(ConsumerConfigurationData<?> conf) {
         synchronized (consumers) {
             Optional<ConsumerBase<?>> subscriber = consumers.keySet().stream()
-                    .filter(consumerBase -> consumerBase.getSubType().equals(PulsarApi.CommandSubscribe.SubType.Shared))
+                    .filter(c -> c.getSubType().equals(PulsarApi.CommandSubscribe.SubType.Shared))
+                    .filter(c -> conf.getTopicNames().contains(c.getTopic()))
 
 Review comment:
   @lovelle I think the PR can address the dup subscription problem. However the side effect of this : for example, if people open two consumers, A and B. with this change A and B are same, so if people close A, B is also not usable anymore.
   
   I do see users using two consumers in this way. they open A to create a subscription and open B to receive message. they close A after created subscription, hence B is not usable and B will receive AlreadyClosedException.
   so I am wondering if we should just first revert the change as what @jiazhai did at #3743 and rethink how do we address the original problem.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services