coderzc commented on code in PR #15963:
URL: https://github.com/apache/pulsar/pull/15963#discussion_r892543367
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentStickyKeyDispatcherMultipleConsumers.java:
##########
@@ -215,13 +219,18 @@ protected void sendMessagesToConsumers(ReadType readType,
List<Entry> entries) {
final Map<Consumer, Set<Integer>> consumerStickyKeyHashesMap = new
HashMap<>();
for (Entry entry : entries) {
- int stickyKeyHash = getStickyKeyHash(entry);
+ final int stickyKeyHash = getStickyKeyHash(entry);
+ final long ledgerId = entry.getLedgerId();
+ final long entryId = entry.getEntryId();
Consumer c = selector.select(stickyKeyHash);
if (c != null) {
groupedEntries.computeIfAbsent(c, k -> new
ArrayList<>()).add(entry);
consumerStickyKeyHashesMap.computeIfAbsent(c, k -> new
HashSet<>()).add(stickyKeyHash);
} else {
- addMessageToReplay(entry.getLedgerId(), entry.getEntryId(),
stickyKeyHash);
+ topic.getBrokerService().executor().schedule(() -> {
Review Comment:
> Is there any difference between scheduled or directly executing the method
`addMessageToReplay`?
>
> Do we need to reset the backoff param?
If not scheduled execution, the failed message will be redelivery
constantly, which will lead to other messages having no chance to be sent.
I think can rest the backoff when matching a consumer
--
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]