教程
上篇相关文章 Springboot项目整合Rabbitmq详细教程
服务端代码示例
@Resource
private RabbitTemplate rabbitTemplate;
/**
* 同步 对外发送消息的方法
* @param msg 具体的消息内容
* @throws Exception
*/
public String syncSend(String msg) {
MessageProperties messageProperties=new MessageProperties();
Message message=new Message(msg.getBytes(StandardCharsets.UTF_8),messageProperties);
String uuid = UUID.randomUUID().toString();
CorrelationData data = new CorrelationData(uuid);
log.info("【发送的消息-社会信用代码】:" + msg);
Object result=rabbitTemplate.convertSendAn