weblqb commented on issue #364:
URL: https://github.com/apache/rocketmq-spring/issues/364#issuecomment-835250983


   > Hi Billy, RocketMQTemplate has an 
asyncSend(RocketMQTemplate#asyncSend(java.lang.String, 
org.springframework.messaging.Message<?>, 
org.apache.rocketmq.client.producer.SendCallback, long, int)) API to send delay 
messages asynchronously.
   
   But actually, there is not in v2.2 RocketMQTemplate. Here are all the 
asyncSend implementations: 
   
   ```java
       public void asyncSend(String destination, Message<?> message, 
SendCallback sendCallback, long timeout) {
           if (!Objects.isNull(message) && 
!Objects.isNull(message.getPayload())) {
               try {
                   org.apache.rocketmq.common.message.Message rocketMsg = 
RocketMQUtil.convertToRocketMessage(this.objectMapper, this.charset, 
destination, message);
                   this.producer.send(rocketMsg, sendCallback, timeout);
               } catch (Exception var7) {
                   log.info("asyncSend failed. destination:{}, message:{} ", 
destination, message);
                   throw new MessagingException(var7.getMessage(), var7);
               }
           } else {
               log.error("asyncSend failed. destination:{}, message is null ", 
destination);
               throw new IllegalArgumentException("`message` and 
`message.payload` cannot be null");
           }
       }
   
       public void asyncSend(String destination, Message<?> message, 
SendCallback sendCallback) {
           this.asyncSend(destination, message, sendCallback, 
(long)this.producer.getSendMsgTimeout());
       }
   
       public void asyncSend(String destination, Object payload, SendCallback 
sendCallback, long timeout) {
           Message<?> message = this.doConvert(payload, (Map)null, 
(MessagePostProcessor)null);
           this.asyncSend(destination, message, sendCallback, timeout);
       }
   
       public void asyncSend(String destination, Object payload, SendCallback 
sendCallback) {
           this.asyncSend(destination, payload, sendCallback, 
(long)this.producer.getSendMsgTimeout());
       }
   ```
   


-- 
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to