Skip to content

[ISSUE #1060] [Java] Enhance the logic of MessageInterceptor - #1061

Merged
lizhimins merged 12 commits into
apache:masterfrom
bcaw-ofeer:feature/add-message-interceptor-context
Sep 4, 2025
Merged

lizhimins merged 12 commits into
apache:masterfrom
bcaw-ofeer:feature/add-message-interceptor-context

Conversation

@bcaw-ofeer

Copy link
Copy Markdown
Contributor

Which Issue(s) This PR Fixes

Fixes #1060

Brief Description

Added MessageInterceptorContext information to provide more comprehensive information to the MessageInterceptor, including the remote address, messages sent by the producer, messages received, message type, consumption exceptions, and more.

@codecov-commenter

codecov-commenter commented Aug 5, 2025 •

Copy link
Copy Markdown

Codecov Report

โŒ Patch coverage is 75.00000% with 10 lines in your changes missing coverage. Please review.
โœ… Project coverage is 53.45%. Comparing base (4076e2b) to head (867a876).
โš ๏ธ Report is 76 commits behind head on master.

Files with missing lines Patch % Lines
...e/rocketmq/client/java/rpc/LoggingInterceptor.java 25.00% 6 Missing โš ๏ธ
...client/java/hook/CompositedMessageInterceptor.java 75.00% 0 Missing and 2 partials โš ๏ธ
...cketmq/client/java/impl/producer/ProducerImpl.java 85.71% 2 Missing โš ๏ธ
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #1061      +/-   ##
============================================
+ Coverage     53.26%   53.45%   +0.18%     
- Complexity      651      693      +42     
============================================
  Files           208      211       +3     
  Lines         14303    14070     -233     
  Branches       5845     5537     -308     
============================================
- Hits           7619     7521      -98     
+ Misses         6308     6167     -141     
- Partials        376      382       +6     
Flag Coverage ฮ”
java 62.00% <75.00%> (+0.31%) โฌ†๏ธ

Flags with carried forward coverage won't be shown. Click here to find out more.

โ˜” View full report in Codecov by Sentry.
๐Ÿ“ข 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.
  • ๐Ÿ“ฆ JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

private static final Logger log = LoggerFactory.getLogger(LoggingInterceptor.class);

private static final LoggingInterceptor INSTANCE = new LoggingInterceptor();
private static String remoteAddr = "";

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.

using static not support muti client instance

public class ConsumeTask implements Callable<ConsumeResult> {
private static final Logger log = LoggerFactory.getLogger(ConsumeTask.class);

private static final String MESSAGE_VIEW_CONTEXT = "messageView";

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.

AttributeKey

* Warning: please DO NOT modify the signature of this method, it is used by OpenTelemetry instrumentation.
*/
private void send0(SettableFuture<List<SendReceiptImpl>> future0, String topic, MessageType messageType,
protected void send0(SettableFuture<List<SendReceiptImpl>> future0, String topic, MessageType messageType,

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.

Warning: please DO NOT modify the signature of this method, it is used by OpenTelemetry instrumentation.

@lizhimins
lizhimins merged commit 6bbd251 into apache:master Sep 4, 2025
terrancesli added a commit to terrancesli/rocketmq-clients that referenced this pull request May 15, 2026
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.

5 participants