rabbitmq 消息队列queue exchange声明实现

1 注解实现

@RabbitHandler
@RabbitListener(containerFactory = “rabbitListenerContainerFactory”, bindings=@QueueBinding(
value=@Queue(value = “${mall.shop.interactiveMsg.topic}”, durable = “true”),
exchange=@Exchange( value = “shopInteractiveExchange”, durable = “true”),
key = “shop.interactive”)
)

在消费者类的消费方法上添加注解,声明queue,exchange(可以不填,则消费会选择默认路由发送方式)

你可能感兴趣的:(rabbitMQ)