Alaske commented on code in PR #10548:
URL: https://github.com/apache/rocketmq/pull/10548#discussion_r3489042729
##########
client/src/main/java/org/apache/rocketmq/client/producer/DefaultMQProducer.java:
##########
@@ -950,6 +950,27 @@ public TransactionSendResult
sendMessageInTransaction(Message msg,
throw new RuntimeException("sendMessageInTransaction not implement,
please use TransactionMQProducer class");
}
+ /**
+ * This method is used to send transactional messages with a message queue
selector.
+ *
+ * <p>The {@code selectorArg} is passed only to {@link
MessageQueueSelector#select(List, Message, Object)}.
+ * The {@code transactionArg} is passed only to {@link
TransactionListener#executeLocalTransaction(Message, Object)}.
+ * This method follows the existing selector send semantics and does not
perform the broker or queue reselection
+ * retry used by the default send path.</p>
+ *
+ * @param msg Transactional message to send.
+ * @param selector Message queue selector.
+ * @param selectorArg Argument used by the selector.
+ * @param transactionArg Argument used along with local transaction
executor.
+ * @return Transaction result.
+ * @throws MQClientException if there is any client error.
+ */
+ @Override
+ public TransactionSendResult sendMessageInTransaction(Message msg,
Review Comment:
Updated. I removed the default implementation from MQProducer and kept the
new method as a regular interface method, consistent with the existing
sendMessageInTransaction(Message, Object) API.
DefaultMQProducer still explicitly implements the method and rejects
transactional sends with the same error message, while TransactionMQProducer
provides the actual selector-aware implementation.
I also verified the related tests with JDK 8.
--
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]