BewareMyPower commented on a change in pull request #14604:
URL: https://github.com/apache/pulsar/pull/14604#discussion_r825640182
##########
File path: pulsar-client-cpp/lib/ConsumerImpl.cc
##########
@@ -1229,7 +1244,17 @@ void ConsumerImpl::seekAsync(const MessageId& msgId,
ResultCallback callback) {
LOG_DEBUG(getName() << " Sending seek Command for Consumer - " <<
getConsumerId() << ", requestId - "
<< requestId);
Future<Result, ResponseData> future =
- cnx->sendRequestWithId(Commands::newSeek(consumerId_, requestId,
msgId), requestId);
+ msgId.isChunkMessageid()
+ ? cnx->sendRequestWithId(
+ Commands::newSeek(consumerId_, requestId,
+
std::dynamic_pointer_cast<ChunkMessageIdImpl>(msgId.impl_)
+ ->getFirstChunkMessageIdImpl()
Review comment:
It's not explicit. Your assumption is based on the fact that
`msgId.isChunkMessageid()` is equivalent to
`std::dynamic_pointer_cast<ChunkMessageIdImpl>(msgId.impl_) != null`. Once the
implementation of `MessageId::isChunkMessageid()` changed, the assumption would
not be right.
It's better not to call `isChunkMessageid()` internally. Just use
```c++
auto chunkMessageId =
std::dynamic_pointer_cast<ChunkMessageIdImpl>(msgId.impl_);
if (chunkMessageId) {
/* do sth with `chunkMessageId`... */
}
```
instead of
```c++
if (msgId.isChunkMessageid()) {
auto chunkMessageId =
std::dynamic_pointer_cast<ChunkMessageIdImpl>(msgId.impl_);
/* do sth with `chunkMessageId`... */
}
```
--
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]