Springboot 使用RabbitMQ
使用RabbitMQ,发送消息时并不是直接发送到Queue中,而是发送到exchange中然后依据发送时的routing key
和绑定到exchange上的binding key
将消息路由到Queue中。
queue&exchange&bingding key
//发送消息
public void sendMessage() {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String json = format.format(new Date());
rabbitTemplate.convertAndSend