
RabbitMQ
文章平均质量分 51
sliver1836
这个作者很懒,什么都没留下…
展开
-
Spring AMQP实现RabbitMQ的5种消息模式
一、简单模式简单模式是最简单的消息模式,它包含一个生产者、一个消费者和一个队列。生产者向队列里发送消息,消费者从队列中获取消息并消费。1. 创建队列simple.hello2import org.springframework.amqp.core.Queue;import org.springframework.context.annotation.Bean;import org.springframework.context.annotation.Configurat..原创 2021-08-23 18:05:15 · 1225 阅读 · 0 评论 -
@RabbitListener和@RabbitHandler的使用
1.@RabbitListener 注解是指定某方法作为消息消费的方法,例如监听某 Queue 里面的消息。2.@RabbitListener标注在方法上,直接监听指定的队列,此时接收的参数需要与发送市类型一致@Componentpublic class PointConsumer { //监听的队列名 @RabbitListener(queues = "point.to.point") public void processOne(String name) {原创 2021-08-16 15:35:37 · 21315 阅读 · 0 评论