private MessageBatch batch(Collection<org.apache.rocketmq.common.message.Message> msgs) throws MQClientException {
        MessageBatch msgBatch;
        try {
            msgBatch = MessageBatch.generateFromList(msgs);
            for (org.apache.rocketmq.common.message.Message message : msgBatch) {
                Validators.checkMessage(message, producer);
                MessageClientIDSetter.setUniqID(message);
                message.setTopic(producer.withNamespace(message.getTopic()));
            }
            msgBatch.setBody(msgBatch.encode());
        } catch (Exception e) {
            throw new MQClientException("Failed to initiate the MessageBatch", e);
        }
        msgBatch.setTopic(producer.withNamespace(msgBatch.getTopic()));
        return msgBatch;
    }
Send Spring Message in Transaction

@param destination destination formats: `topicName:tags`
@param message message {@link org.springframework.messaging.Message}
@param arg ext arg
@return TransactionSendResult
@throws MessagingException
rocketmq-spring-boot/src/main/java/org/apache/rocketmq/spring/core/RocketMQTemplate.java