apache / apache/rocketmq

[Enhancement] Implement FastCodesHeader encode/decode for PullMessageRequestHeader/ResponseHeader

Open
#10,534 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
22.6k
Forks
12k
Avg merge
3d 1h
Merged PRs (30d)
27

Description

### Before Creating the Enhancement Request

- [x] I have confirmed that this should be classified as an enhancement rather than a bug/feature.

### Summary

Implement `FastCodesHeader.encode()/decode()` for `PullMessageRequestHeader` and `PullMessageResponseHeader` to eliminate reflection-based header serialization.

### Motivation

`PullMessageRequestHeader` and `PullMessageResponseHeader` already implement `FastCodesHeader` but their `decode()` methods use `Map` instead of `HashMap`, causing compilation issues with the interface. Additionally, their `encode()` methods can leverage R1's `writeLong`/`writeInt` helpers for numeric fields.

### Describe the Solution You'd Like

Fix `decode()` signatures and optimize `encode()` methods on:
- `PullMessageRequestHeader` — 15 fields including Long/Integer types
- `PullMessageResponseHeader` — 4 fields

### Additional Context

Depends on R1 (#10522, merged). Related PRs: #10443, #10526.

Contributor guide

Open the contributing guide

Research direction

Locate PullMessageRequestHeader, PullMessageResponseHeader, FastCodesHeader, and the R1 writeLong/writeInt helpers. Compare the two header implementations with the interface, correct the decode signatures, and update encode methods for all listed fields; done means the project compiles without the interface mismatch and the reflection-based serialization is removed for these headers.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend-api-design, distributed-systems
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
66/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.