Skip to content

[ISSUE #9326]♻️Inject remoting command factories into client owners - #9331

Merged
mxsm merged 1 commit into
mainfrom
mxsm/inject-client-remoting-command-factories
Aug 13, 2026
Merged

[ISSUE #9326]♻️Inject remoting command factories into client owners#9331
mxsm merged 1 commit into
mainfrom
mxsm/inject-client-remoting-command-factories

Conversation

@mxsm

@mxsm mxsm commented Aug 13, 2026

Copy link
Copy Markdown
Owner

Which Issue(s) This PR Fixes(Closes)

Brief Description

Resolve remoting command defaults once at ClientRuntime construction and inject the resulting immutable RemotingCommandFactory through ClientPool, MQClientInstance, MQClientAPIImpl, and ClientRemotingProcessor.

Client request builders and callback responses now use their owning factory. Explicit factories can isolate embedded client runtimes by version and serialization type, and factory defaults participate in pooled-client identity. The compatibility constructor still captures application defaults, while invalid process configuration now fails at runtime construction before pool admission.

Regression coverage verifies independent JSON and ROCKETMQ owners, outbound request defaults, callback response defaults, pool identity, and startup fail-fast behavior. Request codes, flags, bodies, headers, opaque values, and wire encodings are otherwise unchanged.

How Did You Test This Change?

  • cargo test -p rocketmq-protocol --test remoting_command_defaults
  • cargo test -p rocketmq-protocol protocol::remoting_command::tests --lib
  • cargo test -p rocketmq-protocol --test remoting_wire_golden
  • cargo test -p rocketmq-protocol --test request_header_java_compatibility
  • cargo test -p rocketmq-transport --features test-support --test protocol_compatibility
  • cargo test -p rocketmq-client-rust --lib --all-features (1,063 passed)
  • cargo test -p rocketmq-client-rust --test remoting_defaults_startup --all-features
  • cargo test -p rocketmq-client-rust --all-features -- --skip capability_files_stay_within_the_reviewed_split_limits --skip every_client_cargo_target_declares_a_recursion_limit (passed; the unfiltered checks report two pre-existing origin/main boundary violations in consumer.rs/producer/lifecycle.rs and a missing recursion-limit declaration in nameserver_dns_discovery.rs)
  • cargo clippy -p rocketmq-protocol -p rocketmq-client-rust --no-deps --all-targets --all-features -- -D warnings
  • cargo clippy --workspace --no-deps --all-targets --all-features -- -D warnings
  • Per-package cargo fmt -p <package> -- --check for all 28 root workspace packages (the aggregate cargo fmt --all -- --check hits Windows OS error 206)
  • cargo +nightly-2026-07-05 check --locked --all-targets --all-features in fuzz/
  • cargo fmt -p rocketmq-example -- --check and cargo clippy --all-targets -- -D warnings in rocketmq-example/
  • SRE workspace format, check, Clippy, doc, source-layout, and dependency-boundary gates; RUST_MIN_STACK=16777216 cargo test --locked --workspace --all-features passed (the default Windows test stack overflows in two existing connector tests)
  • .\scripts\runtime-audit.ps1 -SkipBaseline -EnforceBoundaryBaseline

check-error-hygiene.ps1 reports the same two pre-existing findings on this branch and origin/main: source stringification in rocketmq-store-local and sensitive Debug derivation in the dashboard backend.

Summary by CodeRabbit

  • New Features

    • Added support for configuring remoting command protocol versions and serialization formats.
    • Added a runtime option for supplying custom remoting command settings.
    • Command settings now consistently apply across messaging, administration, routing, transactions, and callbacks.
  • Bug Fixes

    • Prevented clients with conflicting remoting defaults from sharing the same client identity.
    • Invalid serialization settings are now rejected during runtime initialization with clearer configuration errors.
  • Tests

    • Added coverage for custom protocol versions, serialization formats, and isolated runtime configurations.

@mxsm
mxsm merged commit d2e7d98 into main Aug 13, 2026
27 of 35 checks passed
@mxsm
mxsm deleted the mxsm/inject-client-remoting-command-factories branch August 13, 2026 06:53
@coderabbitai

coderabbitai Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 5f5de972-e11d-41d1-a145-ee902812a265

📥 Commits

Reviewing files that changed from the base of the PR and between ad9b675 and 20b8076.

📒 Files selected for processing (20)
  • rocketmq-client/src/base/client_options.rs
  • rocketmq-client/src/factory/mq_client_instance.rs
  • rocketmq-client/src/implementation/client_remoting_processor.rs
  • rocketmq-client/src/implementation/mq_client_api_impl.rs
  • rocketmq-client/src/implementation/mq_client_api_impl/admin.rs
  • rocketmq-client/src/implementation/mq_client_api_impl/admin/versioned_config.rs
  • rocketmq-client/src/implementation/mq_client_api_impl/consumer.rs
  • rocketmq-client/src/implementation/mq_client_api_impl/producer.rs
  • rocketmq-client/src/implementation/mq_client_api_impl/request_builder.rs
  • rocketmq-client/src/implementation/mq_client_api_impl/route.rs
  • rocketmq-client/src/implementation/mq_client_api_impl/transaction.rs
  • rocketmq-client/src/implementation/mq_client_api_impl/transport.rs
  • rocketmq-client/src/implementation/mq_client_manager.rs
  • rocketmq-client/src/producer/producer_impl/default_mq_producer_impl/send.rs
  • rocketmq-client/src/runtime.rs
  • rocketmq-client/tests/implementation/mq_client_api_impl/unit.rs
  • rocketmq-client/tests/remoting_defaults_startup.rs
  • rocketmq-protocol/src/protocol/remoting_command_compat.rs
  • rocketmq-protocol/src/protocol/remoting_command_defaults.rs
  • rocketmq-protocol/tests/remoting_command_defaults.rs

Walkthrough

RemotingCommandFactory is now initialized at runtime or supplied through client options, propagated through client ownership layers, and used by request and callback-response construction. Tests cover factory-specific protocol versions, serialization types, runtime isolation, and client identity conflicts.

Changes

Remoting factory propagation

Layer / File(s) Summary
Factory initialization and runtime selection
rocketmq-protocol/src/protocol/..., rocketmq-client/src/runtime.rs, rocketmq-client/tests/remoting_defaults_startup.rs
Runtime construction now selects remoting defaults and can accept an explicit factory. Invalid serialization settings fail during runtime creation.
Client option and owner propagation
rocketmq-client/src/base/client_options.rs, rocketmq-client/src/implementation/mq_client_manager.rs, rocketmq-client/src/factory/mq_client_instance.rs
Client options, pools, and instances carry the selected factory. Factory defaults participate in client identity checks.
API command construction
rocketmq-client/src/implementation/mq_client_api_impl/..., rocketmq-client/src/producer/producer_impl/default_mq_producer_impl/send.rs
Request builders and API operations create commands through the instance factory instead of static constructors.
Callback responses and regression coverage
rocketmq-client/src/implementation/client_remoting_processor.rs, rocketmq-client/tests/implementation/mq_client_api_impl/unit.rs
Callback responses and tested requests preserve configured protocol versions and serialization types.

Estimated code review effort: 4 (Complex) | ~45 minutes

Possibly related PRs

Suggested labels: refactor♻️, approved, auto merge, AI review first

Suggested reviewers: rocketmq-rust-bot

Poem

I hop through commands, factory in paw,
Each wire default follows the law.
Requests and replies now share the same tune,
JSON and RocketMQ dance by the moon.
No global surprise in the burrow tonight.

✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch mxsm/inject-client-remoting-command-factories

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@rocketmq-rust-bot

Copy link
Copy Markdown
Collaborator

🔊@mxsm 🚀Thanks for your contribution🎉!

💡CodeRabbit(AI) will review your code first🔥!

Note

🚨The code review suggestions from CodeRabbit are to be used as a reference only, and the PR submitter can decide whether to make changes based on their own judgment. Ultimately, the project management personnel will conduct the final code review💥.

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

Labels

AI review first Ai review pr first approved PR has approved auto merge ready to review refactor♻️ refactor code waiting-review waiting review this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Refactor♻️] Inject remoting command factories into client owners

3 participants