dongeforever commented on a change in pull request #3807:
URL: https://github.com/apache/rocketmq/pull/3807#discussion_r794459816
##########
File path:
client/src/main/java/org/apache/rocketmq/client/producer/MQProducer.java
##########
@@ -91,6 +91,10 @@ TransactionSendResult sendMessageInTransaction(final Message
msg,
SendResult send(final Collection<Message> msgs) throws MQClientException,
RemotingException, MQBrokerException,
InterruptedException;
+ // for batch msgs with multi topics.
+ SendResult sendMultiTopicBatch(final Collection<Message> msgs) throws
MQClientException, RemotingException, MQBrokerException,
+ InterruptedException;
+
Review comment:
Who has the responsibility to make sure the messages are to be sent to
the same broker? How to make sure it?
This API may cause many difficulties to be compatible with advanced
features, such as logic queue and message with sharding key?
Only the inner topic route has enough information to decide which queue to
be sent for each message. So the multi-topic batch can only be constructed by
the inner MQClientInstance, but not by the user directly.
IMO, it is necessary to raise a RIP and provide a detailed design for this
feature.
##########
File path:
broker/src/main/java/org/apache/rocketmq/broker/processor/SendMessageProcessor.java
##########
@@ -588,6 +603,27 @@ private RemotingCommand
handlePutMessageResult(PutMessageResult putMessageResult
return CompletableFuture.completedFuture(response);
}
+ String[] topics = null;
+ int[] queueIds = null;
+ if (requestHeader.isMultiTopic()) {
+ topics =
requestHeader.getTopic().split(MixAll.BATCH_TOPIC_SPLITTER); // decode topics
+ if (requestHeader.getQueueIds() == null) {
Review comment:
For reference only.
How about providing a common BATCH API style?
Encode/Decode the header and body in batch mode, and reuse the
processor/storage layer.
It is better not to introduce the batch difficulty to the storage layer.
For advanced feature batch consumequeue, it is not able to handle the inner
message num, if the message has multi topic-queues.
--
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]