casuallc commented on a change in pull request #12984:
URL: https://github.com/apache/pulsar/pull/12984#discussion_r760820991



##########
File path: 
pulsar-client/src/main/java/org/apache/pulsar/client/impl/MessageIdImpl.java
##########
@@ -159,7 +159,7 @@ public static MessageId fromByteArrayWithTopic(byte[] data, 
TopicName topicName)
         } else {
             messageId = new MessageIdImpl(idData.getLedgerId(), 
idData.getEntryId(), idData.getPartition());
         }
-        if (idData.getPartition() > -1 && topicName != null) {
+        if (topicName != null) {

Review comment:
       I do not get you point...  This is my test code.
   
   Env: pulsar-2.8.0
   ```
   List<String> topics = new ArrayList<>();
   topics.add("topic01");
   topics.add("topic02");
   
   final Consumer<String> consumer1 = client.newConsumer(Schema.STRING)
                .consumerName("vv-01")
                .topics(topics)
                .subscriptionName("sub-01")
                .subscriptionType(SubscriptionType.Shared)
                .subscribe();
   
   System.out.println(consumer1.getClass()); // 
org.apache.pulsar.client.impl.MultiTopicsConsumerImpl
   
   Message<String> msg = consumer1.receive();
   System.out.println(msg.getMessageId()); // 10:1:-1:0
   System.out.println(msg.getMessageId().getClass()); // class 
org.apache.pulsar.client.impl.TopicMessageIdImpl
   consumer1.acknowledge(msg);
   
   consumer1.close();
   ```
   
   I think both partitioned and non-partitioned topic need `TopicMessageIdImpl`.




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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to