发送邮件添加唯一标识

String msgId = UUID.randomUUID().toString();
rabbitTemplate.convertAndSend(MailConstants.MAIL_EXCHANGE_NAME, MailConstants.MAIL_ROUTING_KEY_NAME, emp, new CorrelationData(msgId));

在Message中的headers headers={amqp_receivedDeliveryMode=PERSISTENT, amqp_receivedRoutingKey=javaboy.mail.routing.key, amqp_receivedExchange=javaboy.mail.exchange, spring_returned_message_correlation=8170350b-3b4d-4f20-89fc-f9e72bf754cb
获取msgId

String msgId = (String) headers.get("spring_returned_message_correlation");