mxsm / rocketmq-rust

🚀Apache RocketMQ Rust implementation. Faster, safer, and with lower memory usage.
https://docs.rs/rocketmq-rust
Apache License 2.0
621 stars 80 forks source link

[ISSUE #763]🔥Topic manager support(Request code:17,18,21,215) 🚀 #764

Closed mxsm closed 4 months ago

mxsm commented 4 months ago

Which Issue(s) This PR Fixes(Closes)

Fixes #763

Brief Description

How Did You Test This Change?

Summary by CodeRabbit

mxsm commented 4 months ago

🚀Thanks for your contribution🎉. CodeRabbit(AI) will review your code first🔥

coderabbitai[bot] commented 4 months ago

[!WARNING]

Review failed

The pull request is closed.

Walkthrough

The changes introduce new features and improvements across multiple modules in the RocketMQ codebase. Key additions include new methods for managing topics and offsets, enhanced deserialization error handling, and new configurations for the broker. The updates to the BrokerRuntime, ConsumerOffsetManager, and BrokerOuterAPI modules, along with the inclusion of new constants, traits, and structs, ensure a more robust and flexible message processing system.

Changes

Files/Modules Change Summaries
rocketmq-broker/src/broker_runtime.rs Added AdminBrokerProcessor in imports; updated initialization in BrokerRuntime.
rocketmq-broker/src/offset/manager/consumer_offset_manager.rs Introduced clean_offset_by_topic and which_group_by_topic public functions.
rocketmq-broker/src/out_api/broker_outer_api.rs Modified JSON decoding of KVTable to include .unwrap() for error handling.
rocketmq-broker/src/processor.rs Added pop_inflight_message_counter module; updated request handling to include await.
rocketmq-common/src/common.rs Added pop_ack_constants and key_builder modules.
rocketmq-common/src/common/attribute.rs Introduced attribute_parser module.
rocketmq-common/src/common/broker/broker_config.rs Added fields validate_system_topic_when_update_topic and enable_mixed_message_type to BrokerConfig struct.
rocketmq-common/src/common/config.rs Added get_topic_message_type method to TopicConfig struct.
rocketmq-common/src/common/key_builder.rs Introduced KeyBuilder module with functions for retry topics management.
rocketmq-common/src/common/pop_ack_constants.rs Added PopAckConstants struct with new constants and methods.
rocketmq-common/src/common/serde_json_utils.rs Modified decode function to return Result<T, SerdeJsonError> instead of directly returning T.
rocketmq-namesrv/src/kvconfig/kvconfig_mananger.rs Added .unwrap() to handle JSON decoding results.
rocketmq-remoting/src/code/request_code.rs Added UpdateAndCreateTopicList variant to RequestCode enum.
rocketmq-remoting/src/protocol.rs Introduced RemotingDeserializable trait with decode method for deserialization.
rocketmq-remoting/src/protocol/body.rs Added create_topic_list_request_body module.
rocketmq-remoting/src/protocol/body/broker_body/register_broker_body.rs Updated JSON decoding to include .unwrap() for RegisterBrokerBody.
rocketmq-remoting/src/protocol/body/create_topic_list_request_body.rs Introduced CreateTopicListRequestBody struct with topic_config_list field.
rocketmq-remoting/src/protocol/body/topic_info_wrapper/topic_config_wrapper.rs Added topic_queue_mapping_detail_map field to TopicConfigAndMappingSerializeWrapper struct.
rocketmq-remoting/src/protocol/header.rs Added modules for create_topic_request_header, delete_topic_request_header and get_all_topic_config_response_header.
rocketmq-remoting/src/protocol/header/create_topic_request_header.rs Introduced CreateTopicRequestHeader struct with serialization, deserialization, and custom header handling capabilities.
rocketmq-remoting/src/protocol/header/delete_topic_request_header.rs Introduced DeleteTopicRequestHeader struct with serialization, deserialization, and custom header handling capabilities.
rocketmq-remoting/src/protocol/header/get_all_topic_config_response_header.rs Introduced GetAllTopicConfigResponseHeader struct implementing CommandCustomHeader trait.
rocketmq-remoting/src/protocol/heartbeat/heartbeat_data.rs Updated tests to include .unwrap() after JSON decoding for HeartbeatData.
rocketmq-store/src/log_file.rs Added delete_topics function to RocketMQMessageStore trait.
rocketmq-store/src/message_store/default_message_store.rs Added delete_topics method to DefaultMessageStore for topic deletion.

Sequence Diagram(s)

No sequence diagrams generated as the changes reflect structural additions and error handling improvements without introducing complex new control flows.

Assessment against linked issues

Objective (Issues) Addressed Explanation
Support for Topic management (17, 18, 21, 215) ✅
Enhanced deserialization error handling ✅
Addition of new broker configurations ✅
Introduction of new constants and modules ✅
Methods for managing offsets and topics ✅

In a world of code so tight and neat,
New changes come, quite the feat!
With topics managed and errors caught,
The RocketMQ ship sails without naught.
Configuration options now abound,
In this update, new strengths are found.
Let’s celebrate this code delight,
For every change, a future bright!


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)
Tips ### Chat There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai): - Review comments: Directly reply to a review comment made by CodeRabbit. Example: - `I pushed a fix in commit .` - `Generate unit testing code for this file.` - `Open a follow-up GitHub issue for this discussion.` - Files and specific lines of code (under the "Files changed" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples: - `@coderabbitai generate unit testing code for this file.` - `@coderabbitai modularize this function.` - PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples: - `@coderabbitai generate interesting stats about this repository and render them as a table.` - `@coderabbitai show all the console.log statements in this repository.` - `@coderabbitai read src/utils.ts and generate unit testing code.` - `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.` - `@coderabbitai help me debug CodeRabbit configuration file.` Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. ### CodeRabbit Commands (invoked as PR comments) - `@coderabbitai pause` to pause the reviews on a PR. - `@coderabbitai resume` to resume the paused reviews. - `@coderabbitai review` to trigger an incremental review. This is useful when automatic reviews are disabled for the repository. - `@coderabbitai full review` to do a full review from scratch and review all the files again. - `@coderabbitai summary` to regenerate the summary of the PR. - `@coderabbitai resolve` resolve all the CodeRabbit review comments. - `@coderabbitai configuration` to show the current CodeRabbit configuration for the repository. - `@coderabbitai help` to get help. Additionally, you can add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed. ### CodeRabbit Configration File (`.coderabbit.yaml`) - You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository. - Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information. - If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json` ### Documentation and Community - Visit our [Documentation](https://coderabbit.ai/docs) for detailed information on how to use CodeRabbit. - Join our [Discord Community](https://discord.com/invite/GsXnASn26c) to get help, request features, and share feedback. - Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.
mxsm commented 4 months ago

🚀Thanks for your contribution🎉. CodeRabbit(AI) will review your code first🔥