mirror of
https://gitee.com/dromara/RuoYi-Vue-Plus.git
synced 2026-09-20 02:08:15 +08:00
24 lines
553 B
Java
24 lines
553 B
Java
package com.ruoyi.mq.service;
|
|
|
|
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
/**
|
|
*
|
|
*/
|
|
@Service
|
|
public class Produceras {
|
|
@Autowired
|
|
private RabbitTemplate rabbitTemplate;
|
|
|
|
|
|
public void sendDelayMsg(String msg, Integer delayTime) {
|
|
rabbitTemplate.convertAndSend("delayed_exchange", "sms", msg, a -> {
|
|
a.getMessageProperties().setDelay(delayTime*1000);
|
|
return a;
|
|
});
|
|
}
|
|
}
|
|
|