This commit is contained in:
张良(004796)
2024-01-19 19:11:18 +08:00
parent 87ed8dbfa7
commit f759a2e45f
6 changed files with 124 additions and 3 deletions

View File

@@ -25,6 +25,16 @@ public class AmqpProducer {
});
}
public void sendCommonDelayMq(CommonDelayDto dto,Integer timeout){
rabbitTemplate.convertAndSend(CommonDelayMqConfig.EXCHANGE_NAME,
CommonDelayMqConfig.ROUTING_KEY,
JSON.toJSONString(dto),
messagePostProcessor -> {
messagePostProcessor.getMessageProperties().setDelay(timeout*1000); // 设置延迟时间,单位毫秒
return messagePostProcessor;
});
}
public void sendCommonDelayMq(Integer type,Long roomId,Integer timeout){
CommonDelayDto dto = new CommonDelayDto();
dto.setType(type);