@@ -538,6 +538,7 @@ public <T extends Message> SendResult syncSend(String destination, Collection<T>
538538
539539 /**
540540 * Same to {@link #syncSend(String, Message)} with send delay time specified in addition.
541+ * This function is only valid when the broker version is 5.0 or above
541542 *
542543 * @param destination formats: `topicName:tags`
543544 * @param message {@link org.springframework.messaging.Message}
@@ -550,6 +551,7 @@ public SendResult syncSendDelayTimeSeconds(String destination, Message<?> messag
550551
551552 /**
552553 * Same to {@link #syncSend(String, Object)} with send delayTime specified in addition.
554+ * This function is only valid when the broker version is 5.0 or above
553555 *
554556 * @param destination formats: `topicName:tags`
555557 * @param payload the Object to use as payload
@@ -561,16 +563,72 @@ public SendResult syncSendDelayTimeSeconds(String destination, Object payload, l
561563 return syncSend (destination , message , producer .getSendMsgTimeout (), delayTime , DelayMode .DELAY_SECONDS );
562564 }
563565
566+ /**
567+ * Same to {@link #syncSend(String, Message)} with send delay time specified in addition.
568+ * This function is only valid when the broker version is 5.0 or above
569+ *
570+ * @param destination formats: `topicName:tags`
571+ * @param message {@link org.springframework.messaging.Message}
572+ * @param delayTime delay time in millisecond for message
573+ * @return {@link SendResult}
574+ */
575+ public SendResult syncSendDelayTimeMills (String destination , Message <?> message , long delayTime ) {
576+ return syncSend (destination , message , producer .getSendMsgTimeout (), delayTime , DelayMode .DELAY_MILLISECONDS );
577+ }
578+
579+ /**
580+ * Same to {@link #syncSend(String, Object)} with send delayTime specified in addition.
581+ * This function is only valid when the broker version is 5.0 or above
582+ *
583+ * @param destination formats: `topicName:tags`
584+ * @param payload the Object to use as payload
585+ * @param delayTime delay time in millisecond for message
586+ * @return {@link SendResult}
587+ */
588+ public SendResult syncSendDelayTimeMills (String destination , Object payload , long delayTime ) {
589+ Message <?> message = MessageBuilder .withPayload (payload ).build ();
590+ return syncSend (destination , message , producer .getSendMsgTimeout (), delayTime , DelayMode .DELAY_MILLISECONDS );
591+ }
592+
593+
594+ /**
595+ * Same to {@link #syncSend(String, Message)} with send in a delivered time.
596+ * This function is only valid when the broker version is 5.0 or above
597+ *
598+ * @param destination formats: `topicName:tags`
599+ * @param message {@link org.springframework.messaging.Message}
600+ * @param deliverTimeMills delivered time in millisecond for message
601+ * @return {@link SendResult}
602+ */
603+ public SendResult syncSendDeliverTimeMills (String destination , Message <?> message , long deliverTimeMills ) {
604+ return syncSend (destination , message , producer .getSendMsgTimeout (), deliverTimeMills , DelayMode .DELIVER_TIME_MILLISECONDS );
605+ }
606+
607+ /**
608+ * Same to {@link #syncSend(String, Object)} with send in a delivered time.
609+ * This function is only valid when the broker version is 5.0 or above
610+ *
611+ * @param destination formats: `topicName:tags`
612+ * @param payload the Object to use as payload
613+ * @param deliverTimeMills delivered time in millisecond for message
614+ * @return {@link SendResult}
615+ */
616+ public SendResult syncSendDeliverTimeMills (String destination , Object payload , long deliverTimeMills ) {
617+ Message <?> message = MessageBuilder .withPayload (payload ).build ();
618+ return syncSend (destination , message , producer .getSendMsgTimeout (), deliverTimeMills , DelayMode .DELIVER_TIME_MILLISECONDS );
619+ }
620+
564621 /**
565622 * Same to {@link #syncSend(String, Message)} with send timeout and delay time specified in addition.
623+ * This function is only valid when the broker version is 5.0 or above
566624 *
567625 * @param destination formats: `topicName:tags`
568626 * @param message {@link org.springframework.messaging.Message}
569627 * @param timeout send timeout with millis
570628 * @param delayTime delay time for message
571629 * @return {@link SendResult}
572630 */
573- public SendResult syncSend (String destination , Message <?> message , long timeout , long delayTime , DelayMode mode ) {
631+ private SendResult syncSend (String destination , Message <?> message , long timeout , long delayTime , DelayMode mode ) {
574632 if (Objects .isNull (message ) || Objects .isNull (message .getPayload ())) {
575633 log .error ("syncSend failed. destination:{}, message is null " , destination );
576634 throw new IllegalArgumentException ("`message` and `message.payload` cannot be null" );
0 commit comments