forked from apache/pulsar
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[C++] Fix message id error when subscribing a single partition (apach…
…e#8341) ### Motivation A consumer/reader can subscribe a single partition of a partitioned topic. However, the partition index was not set correctly. So the partition field of received messages' id is always -1. In addition, current `TopicName#getPartitionIndex` Java implementation doesn't handle some corner cases, like "xxx-partition-00" or "xxx-partition--1". For the backward compatibility, the C++ implementation will use the same implementation and note it in Java `TopicName`'s unit test. ### Modifications - Add `getPartitionIndex` method to `TopicName`; - Set the partition index when a `Consumer` was created from a `Client`; - Set the partition index when a `Reader` was created; - Add relative unit tests for above changes; - Note the "incorrect" behavior in Java `TopicName`'s unit test. ### Verifying this change This change added tests and can be verified as follows: - `TopicNameTest#testPartitionIndex` - `ConsumerTest#testPartitionIndex` - `ReaderTest#testPartitionIndex` * Add getPartitionIndex() method to TopicName * Set partition index when creating a ConsumerImpl from Client * Add test cases to Java TopicName to note the corner cases * Set partition index for Reader * Fix compile error
- Loading branch information
1 parent
94d791b
commit dd8be83
Showing
8 changed files
with
165 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters