[ISSUE #10486] Add getMessageType(Map) overload to eliminate redundant properties decode#10487
Conversation
…dundant properties decode BrokerMetricsManager.getMessageType(SendMessageRequestHeader) is called once per send to classify the message. It internally decodes the properties String into a HashMap, but the typical caller (SendMessageProcessor) has already decoded the same String moments before. The result is a redundant decode allocation per send (one HashMap + ~14 String substrings + one Node[]). This commit adds a public overload getMessageType(Map<String, String>) that lets callers pass an already-decoded Map and reuse it. The existing SendMessageRequestHeader overload now delegates to the new overload; behavior is unchanged for callers that don't have a decoded Map. Downstream callers (e.g. SendMessageProcessor) can switch to the new overload in a separate broker-layer commit.
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Refactors message-type detection to centralize logic based on parsed message properties, improving reuse and reducing duplication.
Changes:
- Changes
getMessageType(SendMessageRequestHeader)to delegate after parsing properties. - Introduces an overload
getMessageType(Map<String, String>)containing the core logic.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #10487 +/- ##
=============================================
- Coverage 48.06% 48.04% -0.02%
- Complexity 13313 13333 +20
=============================================
Files 1377 1377
Lines 100632 100730 +98
Branches 12995 13012 +17
=============================================
+ Hits 48369 48397 +28
- Misses 46344 46387 +43
- Partials 5919 5946 +27 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
RockteMQ-AI
left a comment
There was a problem hiding this comment.
Review: Approved ✅
PR: #10487 — Add getMessageType(Map) overload to eliminate redundant properties decode
Type: Performance (1 file, +4/-1)
Assessment
Eliminates redundant MessageDecoder.string2messageProperties() call in the send hot path. Adds a getMessageType(Map) overload so callers can pass the already-decoded properties map.
Verdict
✅ Clean, minimal change. Fixes #10486.
🤖 Automated review by oss-sentinel-ai
RockteMQ-AI
left a comment
There was a problem hiding this comment.
Review: Approved ✅
PR: #10487 — Add getMessageType(Map) overload to eliminate redundant properties decode
Type: Performance (1 file, +4/-1)
Assessment
Eliminates redundant MessageDecoder.string2messageProperties() call in the send hot path. Adds a getMessageType(Map) overload so callers can pass the already-decoded properties map.
Verdict
✅ Clean, minimal change. Fixes #10486.
🤖 Automated review by oss-sentinel-ai
RockteMQ-AI
left a comment
There was a problem hiding this comment.
Review: Approved ✅
PR: #10487 — Add getMessageType(Map) overload to eliminate redundant properties decode
Type: Performance (1 file, +4/-1)
Assessment
Eliminates redundant MessageDecoder.string2messageProperties() call in the send hot path. Adds a getMessageType(Map) overload so callers can pass the already-decoded properties map.
Verdict
✅ Clean, minimal change. Fixes #10486.
🤖 Automated review by oss-sentinel-ai
RockteMQ-AI
left a comment
There was a problem hiding this comment.
Review: Approved ✅
PR: #10487 — Add getMessageType(Map) overload to eliminate redundant properties decode
Type: Performance (1 file, +4/-1)
Assessment
Eliminates redundant MessageDecoder.string2messageProperties() call in the send hot path. Adds a getMessageType(Map) overload so callers can pass the already-decoded properties map.
Verdict
✅ Clean, minimal change. Fixes #10486.
🤖 Automated review by oss-sentinel-ai
RockteMQ-AI
left a comment
There was a problem hiding this comment.
Review: Approved ✅
PR: #10487 — Add getMessageType(Map) overload to eliminate redundant properties decode
Type: Performance (1 file, +4/-1)
Assessment
Eliminates redundant MessageDecoder.string2messageProperties() call in the send hot path. Adds a getMessageType(Map) overload so callers can pass the already-decoded properties map.
Verdict
✅ Clean, minimal change. Fixes #10486.
🤖 Automated review by oss-sentinel-ai
RockteMQ-AI
left a comment
There was a problem hiding this comment.
Review: Approved ✅
PR: #10487 — Add getMessageType(Map) overload to eliminate redundant properties decode
Type: Performance (1 file, +4/-1)
Assessment
Eliminates redundant MessageDecoder.string2messageProperties() call in the send hot path. Adds a getMessageType(Map) overload so callers can pass the already-decoded properties map.
Verdict
✅ Clean, minimal change. Fixes #10486.
🤖 Automated review by oss-sentinel-ai
RockteMQ-AI
left a comment
There was a problem hiding this comment.
Review: Approved ✅
PR: #10487 — Add getMessageType(Map) overload to eliminate redundant properties decode
Type: Performance (1 file, +4/-1)
Assessment
Eliminates redundant MessageDecoder.string2messageProperties() call in the send hot path. Adds a getMessageType(Map) overload so callers can pass the already-decoded properties map.
Verdict
✅ Clean, minimal change. Fixes #10486.
🤖 Automated review by oss-sentinel-ai
RockteMQ-AI
left a comment
There was a problem hiding this comment.
Review: Approved ✅
PR: #10487 — Add getMessageType(Map) overload to eliminate redundant properties decode
Type: Performance (1 file, +4/-1)
Assessment
Eliminates redundant MessageDecoder.string2messageProperties() call in the send hot path. Adds a getMessageType(Map) overload so callers can pass the already-decoded properties map.
Verdict
✅ Clean, minimal change. Fixes #10486.
🤖 Automated review by oss-sentinel-ai
RockteMQ-AI
left a comment
There was a problem hiding this comment.
Review by github-manager-bot ✅ Approved
PR #10487: [ISSUE #10486] Add getMessageType(Map) overload to eliminate redundant properties decode
Summary
Clean micro-optimization: extracts getMessageType logic into a new Map<String, String> overload, allowing callers that already have a decoded properties map to skip the redundant string2messageProperties() call. The existing SendMessageRequestHeader overload now delegates to the new one.
Analysis
| Dimension | Assessment |
|---|---|
| Correctness | ✅ Clean delegation pattern. No behavior change — the original overload produces identical results via delegation. |
| Performance | ✅ Eliminates one HashMap + ~14 String substring allocations per send RPC. Meaningful for a per-message hot path. |
| Tests | ✅ Existing 27 BrokerMetricsManagerTest tests cover the original overload. |
| Compatibility | ✅ Public API addition only. No breaking changes. |
Verdict: Minimal, well-scoped change (+4/-1). Safe to merge.
Which Issue(s) This PR Fixes
Fixes #10486
Brief Description
BrokerMetricsManager.getMessageType(SendMessageRequestHeader)is called once per send to classify the message (NORMAL/TRANSACTION/DELAY/FIFO). It internally decodes the properties String into aHashMap, but the typical caller (SendMessageProcessor) has already decoded the same String moments before. The result is a redundant decode allocation per send (oneHashMap+ ~14Stringsubstrings + oneNode[]).This PR adds a public overload
getMessageType(Map<String, String>)that lets callers pass an already-decodedMapand reuse it. The existingSendMessageRequestHeaderoverload now delegates to the new overload; behavior is unchanged for callers that don't have a decodedMap.Downstream callers (e.g.
SendMessageProcessor) can switch to the new overload in a separate broker-layer commit.How Did You Test This Change?
BrokerMetricsManagerTest(27 tests) passes. The behavior of the original overload is preserved by delegation.Mapinstead of a freshly decoded one.Independence
This PR is independent of #10443 and #10481 — it doesn't reference any new constants and only restructures
BrokerMetricsManager.getMessageType(...)(1 file, +4/-1).