Skip to content

Commit 7636e89

Browse files
committed
[fix][client] Fix breaking changes for the deprecated methods of TopicMessageIdImpl (#20163)
(cherry picked from commit 6036dcc)
1 parent e8261fc commit 7636e89

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

pulsar-client/src/main/java/org/apache/pulsar/client/impl/TopicMessageIdImpl.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public String getTopicPartitionName() {
6262

6363
@Deprecated
6464
public MessageId getInnerMessageId() {
65-
return new MessageIdImpl(getLedgerId(), getEntryId(), getPartitionIndex());
65+
return msgId;
6666
}
6767

6868
@Override

pulsar-client/src/test/java/org/apache/pulsar/client/impl/TopicMessageIdImplTest.java

+9
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
import static org.testng.Assert.assertEquals;
2222
import static org.testng.Assert.assertNotEquals;
23+
import static org.testng.Assert.assertSame;
2324

2425
import org.testng.annotations.Test;
2526

@@ -54,4 +55,12 @@ public void equalsTest() {
5455
assertNotEquals(topicMsgId1, topicMsgId2);
5556
}
5657

58+
@Test
59+
public void testDeprecatedMethods() {
60+
BatchMessageIdImpl msgId = new BatchMessageIdImpl(1, 2, 3, 4);
61+
TopicMessageIdImpl topicMsgId = new TopicMessageIdImpl("topic-partition-0", "topic", msgId);
62+
assertSame(topicMsgId.getInnerMessageId(), msgId);
63+
assertEquals(topicMsgId.getTopicPartitionName(), topicMsgId.getOwnerTopic());
64+
assertEquals(topicMsgId.getTopicName(), "topic");
65+
}
5766
}

0 commit comments

Comments
 (0)