Commit a12d4b9e authored by yanzg's avatar yanzg

修复等待时间

parent 774463e3
...@@ -84,20 +84,17 @@ public class MessageSendServiceImpl implements MessageSendService { ...@@ -84,20 +84,17 @@ public class MessageSendServiceImpl implements MessageSendService {
// 设置编号 // 设置编号
CorrelationData correlationData = new CorrelationData(); CorrelationData correlationData = new CorrelationData();
correlationData.setId(finalMessageId); correlationData.setId(finalMessageId);
rabbitTemplate.getRabbitTemplate().convertAndSend(req.getExchangeName(), req.getRouteKey(), req.getMessage(), new MessagePostProcessor() { rabbitTemplate.getRabbitTemplate().convertAndSend(req.getExchangeName(), req.getRouteKey(), req.getMessage(), message -> {
@Override // 设置队列消息持久化
public Message postProcessMessage(Message message) throws AmqpException { MessageProperties properties = message.getMessageProperties();
// 设置队列消息持久化 // 设置持久化
MessageProperties properties = message.getMessageProperties(); properties.setDeliveryMode(MessageDeliveryMode.PERSISTENT);
// 设置持久化 // 设置消息编号
properties.setDeliveryMode(MessageDeliveryMode.PERSISTENT); properties.setMessageId(StringHelper.getIdShort(finalMessageId, TEMP_ID));
// 设置消息编号 if (req.getDedTime() > 0) {
properties.setMessageId(StringHelper.getIdShort(finalMessageId, TEMP_ID)); properties.setExpiration(req.getDedTime() + "");
if (req.getDedTime() > 0) {
properties.setExpiration(req.getDedTime() + "");
}
return message;
} }
return message;
}, correlationData); }, correlationData);
return req.getMessageId(); 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