1. 程式人生 > >rabbitmq 訊息佇列queue exchange宣告實現

rabbitmq 訊息佇列queue exchange宣告實現

1 註解實現

@RabbitHandler
@RabbitListener(containerFactory = “rabbitListenerContainerFactory”, [email protected](
[email protected](value = “${mall.shop.interactiveMsg.topic}”, durable = “true”),
[email protected]( value = “shopInteractiveExchange”, durable = “true”),
key = “shop.interactive”)
)

在消費者類的消費方法上添加註解,宣告queue,exchange(可以不填,則消費會選擇預設路由傳送方式)