Skip to content

Commit 6036dcc

Browse files
[fix][client] Fix breaking changes for the deprecated methods of TopicMessageIdImpl (#20163)
1 parent e5a833a commit 6036dcc

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 9 additions & 0 deletions
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)