Skip to content

[ISSUE #6323]🚀Add producer_with_timeout example for RocketMQ#6324

Merged
mxsm merged 1 commit intomainfrom
feat-6323
Feb 14, 2026
Merged

[ISSUE #6323]🚀Add producer_with_timeout example for RocketMQ#6324
mxsm merged 1 commit intomainfrom
feat-6323

Conversation

@mxsm
Copy link
Owner

@mxsm mxsm commented Feb 14, 2026

Which Issue(s) This PR Fixes(Closes)

Brief Description

How Did You Test This Change?

Summary by CodeRabbit

  • Documentation
    • Added a new producer example demonstrating timeout handling with multiple delay configuration options, including delay levels, seconds, milliseconds, and absolute timestamp delivery.

@rocketmq-rust-bot
Copy link
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💥.

@rocketmq-rust-robot rocketmq-rust-robot added the feature🚀 Suggest an idea for this project. label Feb 14, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 14, 2026

Walkthrough

This pull request adds a new RocketMQ producer example demonstrating timeout handling with various delay configurations. It includes a new example file and updates the package manifest to register the example.

Changes

Cohort / File(s) Summary
Configuration
rocketmq-example/Cargo.toml
Registers new example entry "producer-with-timeout" with path to producer_with_timeout.rs.
Example Implementation
rocketmq-example/examples/producer/producer_with_timeout.rs
New example demonstrating RocketMQ producer with timeout handling. Initializes a DefaultMQProducer, sends four messages with different delay configurations (delay_level, delay_secs, delay_millis, deliver_time_ms) using send_with_timeout, and gracefully shuts down the producer.

Suggested Labels

feature🚀, ready to review

Suggested Reviewers

  • TeslaRustor
  • SpaceXCN
  • rocketmq-rust-bot

Poem

🐰 A timeout example hops into place,
With delays in every form and grace,
From milliseconds to absolute time,
The producer's patience—sublime!
Four messages dance, then rest they must,
In RocketMQ we place our trust. ✨

Estimated Code Review Effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 5 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Merge Conflict Detection ⚠️ Warning ⚠️ Unable to check for merge conflicts: Stream setup permanently failed: Sandbox setup timed out after 180000ms
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: adding a producer_with_timeout example for RocketMQ, which directly aligns with the changeset.
Linked Issues check ✅ Passed The PR successfully implements the feature requested in issue #6323 by adding a new producer_with_timeout example with timeout handling and various delay/delivery configurations.
Out of Scope Changes check ✅ Passed All changes are within scope: the new example file and Cargo.toml update directly address the linked issue requirement to add a producer_with_timeout example.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat-6323
⚔️ Resolve merge conflicts (beta)
  • Auto-commit resolved conflicts to branch feat-6323
  • Create stacked PR with resolved conflicts
  • Post resolved changes as copyable diffs in a comment

Warning

Review ran into problems

🔥 Problems

Git: Failed to clone repository. Please run the @coderabbitai full review command to re-trigger a full review. If the issue persists, set path_filters to include or exclude specific files.


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 and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@rocketmq-example/examples/producer/producer_with_timeout.rs`:
- Line 21: The constant MESSAGE_COUNT is declared but never used; either remove
the unused const or use MESSAGE_COUNT to drive the number of messages sent
(e.g., replace any hard-coded message count in the producer loop with
MESSAGE_COUNT or use it when constructing/scheduling messages in the main
producer logic), ensuring all references to a fixed count are replaced so the
constant is actually consumed.

use rocketmq_error::RocketMQResult;
use rocketmq_rust::rocketmq;

pub const MESSAGE_COUNT: usize = 1;
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

MESSAGE_COUNT is defined but never used.

This constant is declared but not referenced anywhere in the example.

Proposed fix
-pub const MESSAGE_COUNT: usize = 1;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
pub const MESSAGE_COUNT: usize = 1;
🤖 Prompt for AI Agents
In `@rocketmq-example/examples/producer/producer_with_timeout.rs` at line 21, The
constant MESSAGE_COUNT is declared but never used; either remove the unused
const or use MESSAGE_COUNT to drive the number of messages sent (e.g., replace
any hard-coded message count in the producer loop with MESSAGE_COUNT or use it
when constructing/scheduling messages in the main producer logic), ensuring all
references to a fixed count are replaced so the constant is actually consumed.

Copy link
Collaborator

@rocketmq-rust-bot rocketmq-rust-bot left a comment

Choose a reason for hiding this comment

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

LGTM - All CI checks passed ✅

@mxsm mxsm merged commit a1a1505 into main Feb 14, 2026
17 checks passed
@rocketmq-rust-bot rocketmq-rust-bot added approved PR has approved and removed ready to review waiting-review waiting review this PR labels Feb 14, 2026
@mxsm mxsm deleted the feat-6323 branch February 22, 2026 05:26
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 feature🚀 Suggest an idea for this project.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature🚀] Add producer_with_timeout example for RocketMQ

3 participants