//1. 手动创建,需在RabbitMQ中手动创建myQueue1 队列,否则报错
@RabbitListener(queues = “myQueue1”)
public void process1(String message){
log.info(“MqReceiver1: {}”, message);
}
//2. 自动创建队列
@RabbitListener(queuesToDeclare = @Queue(“myQueue2”))
public void process2(String message){
log.info(“MqReceiver2: {}”, message);
}
//3. 自动创建队列,Exchange 与 Queue绑定
@RabbitListener(bindings = @QueueBinding(
value = @Queue(“myQueue3”),
exchange = @Exchange(“testExChange”)
))
public void process3(String message){
log.info(“MqReceiver3: {}”, message);
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)