Skip to content

[ISSUE #10622] [Enhancement] LiteEventDispatcher resolve ConsumerOffsetManager dynamically for better extensibility#10623

Merged
lizhimins merged 1 commit into
apache:developfrom
f1amingo:enhancement/lite-dispatcher-dynamic-offset-manager
Jul 17, 2026
Merged

[ISSUE #10622] [Enhancement] LiteEventDispatcher resolve ConsumerOffsetManager dynamically for better extensibility#10623
lizhimins merged 1 commit into
apache:developfrom
f1amingo:enhancement/lite-dispatcher-dynamic-offset-manager

Conversation

@f1amingo

Copy link
Copy Markdown
Contributor

Which Issue(s) This PR Fixes

Brief Description

Projects that build on top of this core may replace the ConsumerOffsetManager implementation at the upper level. The dispatcher currently caches the manager as a final field at construction time, so the customized manager never takes effect.

This PR resolves the manager lazily via brokerController.getConsumerOffsetManager() instead of caching it in a field, allowing downstream projects to swap in their own implementation after the broker is fully initialized.

How Did You Test This Change?

Existing unit tests cover the dispatcher logic. The change is minimal (2 insertions, 5 deletions) and does not alter behavior — only the resolution path.

…eEventDispatcher

- Remove cached consumerOffsetManager field from LiteEventDispatcher
- Replace all usages with brokerController.getConsumerOffsetManager() for lazy resolution
- Allows downstream projects to swap ConsumerOffsetManager after broker init

@imzs imzs left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@RockteMQ-AI RockteMQ-AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Review by github-manager-bot

Summary

Removes the cached ConsumerOffsetManager field in LiteEventDispatcher and resolves it dynamically via brokerController.getConsumerOffsetManager() at each call site, enabling downstream projects to swap in a custom implementation after broker initialization.

Findings

  • [Info] LiteEventDispatcher.java:227,271 — The dynamic resolution adds a getter call on every dispatch iteration. Since getConsumerOffsetManager() is a simple field accessor on BrokerController, the overhead is negligible. ✅
  • [Info] The change is minimal (2 insertions, 5 deletions) and preserves existing behavior — only the resolution path changes. ✅
  • [Info] Good extensibility improvement for downstream projects that customize ConsumerOffsetManager.

Verdict

Clean, low-risk refactoring. LGTM.


Automated review by github-manager-bot

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 50.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 48.22%. Comparing base (45254d5) to head (7141481).

Files with missing lines Patch % Lines
...ache/rocketmq/broker/lite/LiteEventDispatcher.java 50.00% 1 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             develop   #10623      +/-   ##
=============================================
- Coverage      48.35%   48.22%   -0.13%     
+ Complexity     13490    13456      -34     
=============================================
  Files           1380     1380              
  Lines         101009   101008       -1     
  Branches       13080    13080              
=============================================
- Hits           48840    48711     -129     
- Misses         46219    46320     +101     
- Partials        5950     5977      +27     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@lizhimins
lizhimins merged commit 26cfb5f into apache:develop Jul 17, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Enhancement] LiteEventDispatcher resolve ConsumerOffsetManager dynamically for better extensibility

6 participants