Commit a12d4b9e authored by yanzg's avatar yanzg

修复等待时间

parent 774463e3
......@@ -84,20 +84,17 @@ public class MessageSendServiceImpl implements MessageSendService {
// 设置编号
CorrelationData correlationData = new CorrelationData();
correlationData.setId(finalMessageId);
rabbitTemplate.getRabbitTemplate().convertAndSend(req.getExchangeName(), req.getRouteKey(), req.getMessage(), new MessagePostProcessor() {
@Override
public Message postProcessMessage(Message message) throws AmqpException {
// 设置队列消息持久化
MessageProperties properties = message.getMessageProperties();
// 设置持久化
properties.setDeliveryMode(MessageDeliveryMode.PERSISTENT);
// 设置消息编号
properties.setMessageId(StringHelper.getIdShort(finalMessageId, TEMP_ID));
if (req.getDedTime() > 0) {
properties.setExpiration(req.getDedTime() + "");
}
return message;
rabbitTemplate.getRabbitTemplate().convertAndSend(req.getExchangeName(), req.getRouteKey(), req.getMessage(), message -> {
// 设置队列消息持久化
MessageProperties properties = message.getMessageProperties();
// 设置持久化
properties.setDeliveryMode(MessageDeliveryMode.PERSISTENT);
// 设置消息编号
properties.setMessageId(StringHelper.getIdShort(finalMessageId, TEMP_ID));
if (req.getDedTime() > 0) {
properties.setExpiration(req.getDedTime() + "");
}
return message;
}, correlationData);
return req.getMessageId();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment