//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);
}文章来源:https://www.toymoban.com/news/detail-613575.html
//3. 自动创建队列,Exchange 与 Queue绑定
@RabbitListener(bindings = @QueueBinding(
value = @Queue(“myQueue3”),
exchange = @Exchange(“testExChange”)
))
public void process3(String message){
log.info(“MqReceiver3: {}”, message);
}文章来源地址https://www.toymoban.com/news/detail-613575.html
到了这里,关于RabbitMQ 简单实现创建队列的三种方式的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!