[ISSUE #6914]📝Complete consumer section parity with English and fix deps#7033
[ISSUE #6914]📝Complete consumer section parity with English and fix deps#7033WaterWhisperer wants to merge 1 commit intomxsm:mainfrom
Conversation
|
🔊@WaterWhisperer 🚀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💥. |
WalkthroughThis pull request removes the unused Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 12
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In
`@rocketmq-website/i18n/zh-CN/docusaurus-plugin-content-docs/current/consumer/message-filtering.md`:
- Around line 74-80: The example uses Message::new and calls put_property with
raw string literals, but put_property expects CheetahString values; update each
put_property call to convert keys and values using
CheetahString::from_static_str (e.g., replace message.put_property("amount",
"150.00") with message.put_property(CheetahString::from_static_str("amount"),
CheetahString::from_static_str("150.00")) for all property calls before
producer.send(message).await?).
In
`@rocketmq-website/i18n/zh-CN/docusaurus-plugin-content-docs/current/consumer/overview.md`:
- Around line 96-123: Replace the non-existent trait/enum usage: implement
either MessageListenerConcurrently or MessageListenerOrderly instead of
MessageListener; change the consume_message signature to accept the context
parameter and return a Result with the appropriate status enum (e.g.,
Result<ConsumeConcurrentlyStatus, Error> for concurrent or
Result<ConsumeOrderlyStatus, Error> for orderly) rather than returning the
status directly; use the correct status variants
(ConsumeConcurrentlyStatus::ConsumeSuccess / ::ReconsumeLater for concurrent;
ConsumeOrderlyStatus::Success / ::SuspendCurrentQueueAMoment / ::Rollback /
::Commit for orderly); update the impl block for consume_message, update calls
to process_message(&msg) to propagate/convert errors into the Result error, and
keep MessageExt and process_message names but ensure process_message returns
Result<(), Error> with a matching Error type used in the consume_message Result.
- Around line 222-231: The code example incorrectly calls commit_sync with
parameters and `?`; update the snippet to use the correct API: either show a
LitePullConsumer calling `commit_sync().await;` (and move the auto-commit
setting to the consumer builder rather than
`consumer_option.set_enable_auto_commit`) or demonstrate the map variant by
building a `HashMap<MessageQueue, i64>` and calling `commit_sync_with_map(map,
true).await;`; alternatively prefer the non-deprecated `commit().await` or
`commit_with_map(map).await` variants and remove any `?` error operator since
these methods do not return `Result`.
- Around line 129-143: Replace the nonexistent ConsumerOption example with the
real builder API: use DefaultMQPushConsumerBuilder and its fluent methods
instead of ConsumerOption and set_* methods; for example, call
DefaultMQPushConsumerBuilder::new() (or the crate's builder constructor) and
chain .name_server_addr(...), .consumer_group(...), .consume_thread_min(...),
.consume_thread_max(...), .pull_batch_size(...), and .pull_interval(...) to
configure the consumer options so the example compiles with the actual API.
In
`@rocketmq-website/i18n/zh-CN/docusaurus-plugin-content-docs/current/consumer/pull-consumer.md`:
- Around line 87-101: The example uses non-existent fields on PullResult; change
accesses to use result.msg_found_list (which is an
Option<Vec<ArcMut<MessageExt>>>) and handle it via match or if let Some(msgs) {
for msg in msgs { process_message(&msg); } } (or call the public getter if
provided), and treat result.next_begin_offset as a plain u64 (update
tracker.update(&queue, result.next_begin_offset) unconditionally) instead of
checking for Some(...); keep references to consumer.pull_from_offset,
tracker.update, and process_message when making these edits.
- Around line 28-64: The examples use non-existent methods pull(), pull_from(),
and pull_from_offset(); update them to the actual LitePullConsumer API: replace
pull(...) with poll() or poll_with_timeout(...) when fetching messages (refer to
consumer.poll or consumer.poll_with_timeout), replace
fetch_subscribe_message_queues(...) and pull_from(...) usage with
fetch_message_queues() and iterate those MessageQueue entries (refer to
consumer.fetch_message_queues), and replace pull_from_offset(...) with the seek
API (consumer.seek(), consumer.seek_to_begin(), or consumer.seek_to_end()) to
position offsets before calling poll/poll_with_timeout; ensure the code examples
reference the LitePullConsumer trait methods and the same consumer/MessageQueue
symbols used in the doc.
- Around line 205-226: The example uses a non-existent PullError enum and a
wrong variant name; change the error match arms to use the real enum and
variants from the codebase (use PullStatus::NoNewMsg instead of NoNewMessage and
PullStatus::OffsetIllegal instead of referencing PullError), i.e. update the
match on consumer.pull(...).await to handle Err(PullStatus::NoNewMsg) and
Err(PullStatus::OffsetIllegal) (and adjust any necessary imports or
fully-qualify PullStatus) so the example compiles against the current API.
- Around line 12-22: The docs show non-existent APIs PullConsumer::new and
rocketmq::conf::ConsumerOption; update the example to use the actual
builder-based API (DefaultLitePullConsumer and its builder) that exists in the
codebase. Replace references to PullConsumer::new and ConsumerOption with
DefaultLitePullConsumer::builder() (or the crate's documented builder method),
setting name_server_addr and group_name via the builder, then call build() and
start()/await as per the real API; ensure the example imports
DefaultLitePullConsumer and uses the correct builder method names from the
implementation.
In
`@rocketmq-website/i18n/zh-CN/docusaurus-plugin-content-docs/current/consumer/push-consumer.md`:
- Around line 57-75: The MessageListenerOrderly implementation signature is
incorrect: update the impl of MessageListenerOrderly for OrderListener so its
consume_message method matches the trait: fn consume_message(&self, msgs:
&[&MessageExt], context: &mut ConsumeOrderlyContext) ->
RocketMQResult<ConsumeOrderlyStatus>; process messages using msgs (the slice of
references) and return an Ok(ConsumeOrderlyStatus::Success) or other
ConsumeOrderlyStatus variant as appropriate; ensure you import/use
RocketMQResult and ConsumeOrderlyStatus and wrap the status in Ok() when
returning from consume_message.
- Around line 128-133: The example calls to consumer.suspend() and
consumer.resume() use async methods without awaiting; update the snippet to
await both async functions by calling consumer.suspend().await and
consumer.resume().await so the code compiles and correctly awaits the async fn
implementations of suspend and resume on PushConsumer.
- Around line 151-156: The examples use nonexistent methods seek_by_timestamp
and seek_to_offset on PushConsumer; remove or correct them by either deleting
these two example lines or switching the snippet to use LitePullConsumer (e.g.,
create a LitePullConsumer and call its seek(), seek_to_begin(), or seek_to_end()
methods) instead; update any surrounding text to reference PushConsumer has no
seek and that seek methods live on LitePullConsumer (symbols: PushConsumer,
LitePullConsumer, seek_by_timestamp, seek_to_offset, seek, seek_to_begin,
seek_to_end).
- Around line 32-50: The documentation example implements
MessageListenerConcurrently with the wrong consume_message signature; update
MyListener::consume_message to match the trait: change the parameters to (
&self, msgs: &[&MessageExt], context: &ConsumeConcurrentlyContext ) and change
the return type to rocketmq_error::RocketMQResult<ConsumeConcurrentlyStatus>;
inside the method iterate over msgs (e.g., for msg in msgs { ... }) and return
Ok(ConsumeConcurrentlyStatus::ConsumeSuccess) (or the appropriate status) so the
example compiles against the real trait.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 596d1952-e5b1-4a50-99ed-d6f85d11788d
⛔ Files ignored due to path filters (1)
Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (9)
rocketmq-controller/Cargo.tomlrocketmq-website/docs/consumer/message-filtering.mdrocketmq-website/docs/consumer/overview.mdrocketmq-website/docs/consumer/pull-consumer.mdrocketmq-website/docs/consumer/push-consumer.mdrocketmq-website/i18n/zh-CN/docusaurus-plugin-content-docs/current/consumer/message-filtering.mdrocketmq-website/i18n/zh-CN/docusaurus-plugin-content-docs/current/consumer/overview.mdrocketmq-website/i18n/zh-CN/docusaurus-plugin-content-docs/current/consumer/pull-consumer.mdrocketmq-website/i18n/zh-CN/docusaurus-plugin-content-docs/current/consumer/push-consumer.md
💤 Files with no reviewable changes (1)
- rocketmq-controller/Cargo.toml
...etmq-website/i18n/zh-CN/docusaurus-plugin-content-docs/current/consumer/message-filtering.md
Show resolved
Hide resolved
rocketmq-website/i18n/zh-CN/docusaurus-plugin-content-docs/current/consumer/overview.md
Show resolved
Hide resolved
rocketmq-website/i18n/zh-CN/docusaurus-plugin-content-docs/current/consumer/overview.md
Show resolved
Hide resolved
rocketmq-website/i18n/zh-CN/docusaurus-plugin-content-docs/current/consumer/overview.md
Show resolved
Hide resolved
rocketmq-website/i18n/zh-CN/docusaurus-plugin-content-docs/current/consumer/pull-consumer.md
Show resolved
Hide resolved
rocketmq-website/i18n/zh-CN/docusaurus-plugin-content-docs/current/consumer/pull-consumer.md
Show resolved
Hide resolved
rocketmq-website/i18n/zh-CN/docusaurus-plugin-content-docs/current/consumer/push-consumer.md
Show resolved
Hide resolved
rocketmq-website/i18n/zh-CN/docusaurus-plugin-content-docs/current/consumer/push-consumer.md
Show resolved
Hide resolved
rocketmq-website/i18n/zh-CN/docusaurus-plugin-content-docs/current/consumer/push-consumer.md
Show resolved
Hide resolved
rocketmq-website/i18n/zh-CN/docusaurus-plugin-content-docs/current/consumer/push-consumer.md
Show resolved
Hide resolved
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7033 +/- ##
==========================================
- Coverage 55.41% 55.39% -0.02%
==========================================
Files 1061 1061
Lines 174383 174383
==========================================
- Hits 96630 96608 -22
- Misses 77753 77775 +22 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Which Issue(s) This PR Fixes(Closes)
Brief Description
How Did You Test This Change?
Summary by CodeRabbit
Documentation
Chores