Skip to content

Conversation

@zjxxzjwang
Copy link
Contributor

Motivation

When no consumers are online for a subscription, sending chunked messages will be lost.

Clipboard_Screenshot_1765871357

Modifications

When no subscribers are online, send chunk messages to deliver them to the redeliveryMessages queue. When a subscriber comes online, it can consume the messages again.

Documentation

  • doc
  • doc-required
  • doc-not-needed
  • doc-complete

@github-actions
Copy link

@zjxxzjwang Please add the following content to your PR description and select a checkbox:

- [ ] `doc` <!-- Your PR contains doc changes -->
- [ ] `doc-required` <!-- Your PR changes impact docs and you will update later -->
- [ ] `doc-not-needed` <!-- Your PR changes do not impact docs -->
- [ ] `doc-complete` <!-- Docs have been already added -->

Copy link
Member

@lhotari lhotari left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR @zjxxzjwang . Please add a test that demonstrates the broken behavior and shows that the changes in this PR fix the problem.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes an issue where chunked messages would be lost when no consumers are online for a subscription. The fix ensures that when no consumer is available to receive messages, the messages are sent to the redelivery queue instead of being released, allowing them to be consumed when consumers come back online.

Key Changes

  • Modified SharedConsumerAssignor to accept a Subscription parameter for logging and to process unassigned messages instead of releasing them
  • Updated both PersistentDispatcherMultipleConsumers and PersistentDispatcherMultipleConsumersClassic to pass the subscription to the assignor
  • Added logging when no consumer is found to assign messages

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/SharedConsumerAssignor.java Core fix: Added subscription parameter, logging, and changed to use unassignedMessageProcessor instead of releasing entries when no consumers are available
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentDispatcherMultipleConsumers.java Updated SharedConsumerAssignor constructor call to pass subscription parameter
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentDispatcherMultipleConsumersClassic.java Updated SharedConsumerAssignor constructor call to pass subscription parameter
pulsar-broker/src/test/java/org/apache/pulsar/broker/service/SharedConsumerAssignorTest.java Updated test to pass null for subscription parameter in constructor

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@zjxxzjwang
Copy link
Contributor Author

Thanks for the PR @zjxxzjwang . Please add a test that demonstrates the broken behavior and shows that the changes in this PR fix the problem.

@lhotari Okay, I will make additional comments

@zjxxzjwang zjxxzjwang requested a review from lhotari December 22, 2025 15:11
@zjxxzjwang
Copy link
Contributor Author

@lhotari I have submitted the test cases, please review them

@zjxxzjwang
Copy link
Contributor Author

@lhotari Hello, please review it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants