rdhabalia opened a new issue, #20221:
URL: https://github.com/apache/pulsar/issues/20221

   # Motivation
   
   Pulsar api provides 
[MessageId](https://github.com/apache/pulsar/blob/master/pulsar-client-api/src/main/java/org/apache/pulsar/client/api/MessageId.java)
 interface which is generally used by producer and consumer applications to 
manage topic offset. Sometimes, these applications would like to serialize and 
deserialize messageIds specifically consumer app which would like to persist 
messageId and ack with those messageIds by deserializing them. However, right 
now Pulsar doesn't support correct deserialization of multi-topic or 
partitioned-topic because of that 1acknowledge` API call fails for those topics 
with below error
   ```
   org.apache.pulsar.client.api.PulsarClientException$NotAllowedException: Only 
TopicMessageId is allowed to acknowledge for a multi-topics consumer, while 
messageId is org.apache.pulsar.client.impl.BatchMessageIdImpl
        at 
org.apache.pulsar.client.api.PulsarClientException.unwrap(PulsarClientException.java:1083)
        at 
org.apache.pulsar.client.impl.ConsumerBase.acknowledge(ConsumerBase.java:418)
        at 
org.apache.pulsar.client.api.MultiTopicsConsumerTest.testMultiTopicAckWithByteMessageId(MultiTopicsConsumerTest.java:409)
        at 
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   ```
   
   
[MessageIdImpl](https://github.com/apache/pulsar/blob/master/pulsar-client/src/main/java/org/apache/pulsar/client/impl/MessageIdImpl.java#L89)
 stores id metadata into `MessageIdData` which is doesn't contain context about 
topic name to find out which topic belongs to this MessageID. Thefore, we need 
to add topic-name into `MessageIdData` and allow multi-topic/partitioned topic 
to deserialize message correctly so, API like `acknowledge` can perform as 
expected.
   
   This issue is already implemented in this PR: 
https://github.com/apache/pulsar/pull/19944
   
   


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