rdhabalia commented on a change in pull request #942: Bugfix: duplicate 
messages for PartitionedConsumers.
URL: https://github.com/apache/incubator-pulsar/pull/942#discussion_r155616782
 
 

 ##########
 File path: 
pulsar-client/src/main/java/org/apache/pulsar/client/impl/PartitionedConsumerImpl.java
 ##########
 @@ -191,7 +200,9 @@ protected Message internalReceive(int timeout, TimeUnit 
unit) throws PulsarClien
         Message message;
         try {
             lock.writeLock().lock();
-            message = incomingMessages.poll(0, TimeUnit.SECONDS);
+            message = (incomingMessages.size() > 0) ?
+                    incomingMessages.poll(0, TimeUnit.SECONDS) : 
messageFromConsumerImpl();
 
 Review comment:
   > `if (message == null && numMessagesInQueue() == 0) {..}`
   
   I am not sure how this condition will help. If `message=null` and 
`numMessagesInQueue` is empty then also we want to add listener on internal 
individual consumer  to receive message when it's available. In your condition: 
if `message=null` and  `numMessagesInQueue` is not empty then it will complete 
result with `null` result and it will give NPE to client.

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


With regards,
Apache Git Services

Reply via email to