BewareMyPower commented on pull request #8606:
URL: https://github.com/apache/pulsar/pull/8606#issuecomment-735682181
@saosir It's pleasure to have your contribution.
By the way, I just looked at the `UnAckedMessageTrackerEnabled` again.
There's something to correct.
When you created a consumer with unacked messages tracker enabled like:
```c++
Consumer consumer;
ConsumerConfiguration consumerConf;
consumerConf.setUnAckedMessagesTimeoutMs(11000); // must >= 10000
consumerConf.setTickDurationInMs(11000);
Result result = client.subscribe("my-topic", "consumer-1", consumerConf,
consumer);
```
If `my-topic` has N partitions, N+1 `UnAckedMessageTrackerEnabled` will be
created. However, **only the tracker of `PartitionedConsumerImpl` will add
message id.** Because when the internal consumers were created, the listener
was set with the partitioned consumer's method, see
https://github.com/apache/pulsar/blob/102fa9de03509b86e47f58ab8e1c0dde2095da3b/pulsar-client-cpp/lib/PartitionedConsumerImpl.cc#L231-L232
And `ConsumerImpl::messageReceived` wouldn't be called, which means
`ConsumerImpl#notifyPendingReceivedCallback` and
`ConsumerImpl#internalListener` wouldn't be called.
Therefore, the trackers of sub-consumers only do the redelivery but not add
any message id, see
https://github.com/apache/pulsar/blob/102fa9de03509b86e47f58ab8e1c0dde2095da3b/pulsar-client-cpp/lib/PartitionedConsumerImpl.cc#L497-L499
`redeliverUnacknowledgedMessages(messageIds)` for shared and key shared
subscriptions, and `redeliverUnacknowledgedMessages()` for other subscriptions.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]