leizhiyuan opened a new issue, #1418: URL: https://github.com/apache/rocketmq-clients/issues/1418
### Before Creating the Bug Report - [x] I found a bug, not just asking a question, which should be created in [GitHub Discussions](https://github.com/apache/rocketmq-clients/discussions). - [x] I have searched the [GitHub Issues](https://github.com/apache/rocketmq-clients/issues) and [GitHub Discussions](https://github.com/apache/rocketmq-clients/discussions) of this repository and believe that this is not a duplicate. - [x] I have confirmed that this bug belongs to the current repository, not other repositories of RocketMQ. ### Programming Language of the Client Rust ### Runtime Platform Environment macOS 27 (arm64) ### RocketMQ Version of the Client/Server Client: Rust `rocketmq` 5.0.0, master `a3d1de8b` Server: a managed RocketMQ 5.x service (Tencent Cloud TDMQ for RocketMQ 5), gRPC proxy endpoint ### Run or Compiler Version rustc 1.98.0 ### Describe the Bug `MessageBuilder` accepts an empty or blank lite topic. The message builds successfully, and the mistake only surfaces when the server rejects the send, with an error that does not point at the lite topic. **Scenario.** The lite topic usually comes from business data, such as a session or device id. When that value is missing, the application builds a lite message with `""` or `" "` and only learns about it from a server error after a round trip. For an empty string the error is misleading: the server reports a message type mismatch instead of an invalid lite topic. | lite topic | `build()` | `send()` | |---|---|---| | `""` | `Ok` | `Server error ... code: 40014, TopicMessageType validate failed, the expected type is LITE, but actual type is NORMAL` | | `" "` | `Ok` | `Server error ... code: 40020, lite topic cannot be the char sequence of whitespace` | The empty string loses the lite semantics on the wire, since protobuf does not distinguish an empty `lite_topic` from an unset one. That is why the server sees a NORMAL message on a LITE topic. **Java behavior.** `MessageBuilderImpl#setLiteTopic` rejects it up front: ```java checkArgument(StringUtils.isNotBlank(liteTopic), "liteTopic should not be blank"); ``` The Rust builder already checks the other lite constraints in `build()` (`lite_topic and message_group can not be set at the same time`, etc.), but not blankness. ### Steps to Reproduce ```rust let message = MessageBuilder::lite_message_builder("my_topic", b"body".to_vec(), "").build(); // Ok producer.send(message.unwrap()).await; // Err from the server, code 40014 ``` The same happens with `MessageBuilder::builder()...set_lite_topic(" ")`. ### What Did You Expect to See? `build()` fails with `InvalidMessage` and a message saying that the lite topic is blank, as the Java client does. ### What Did You See Instead? `build()` succeeds, and the send fails on the server with `40014` or `40020`. ### Additional Context --- Tracked in #1412. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
