/**
* 发送消息
* @param user
*/
@RequestMapping(value = prefix+"/setRabbitMessage", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public void setMessage(@RequestBody User user) {
rabbitTemplate.convertSendAndReceive(env.getProperty("mq.exchange.order.exchange"), env.getProperty("mq.exchange.order.routing.key"), user, new MessagePostProcessor() {
@Override
public Message postProcessMessage(Message message) throws AmqpException {
MessageProperties properties = message.getMessageProperties();
properties.setDeliveryMode(MessageDeliveryMode.PERSISTENT);
properties.setMessageId(UUID.randomUUID()+"");
return message;
}
});