1 引入 maven 依賴spring
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-amqp</artifactId> <version>2.0.3.RELEASE</version> </dependency>
2 進入死信對列的條件maven
過時的消息、basic.nack或basic.reject且default-requeue-rejected參數爲false或隊列滿的消息將進入此交換器spring-boot
經過綁定隊列的死信交換器來實現死信隊列spa
x-dead-letter-exchange:綁定死信交換器(其實也是普通交換器,與類型無關)
x-dead-letter-routing-key:綁定死信隊列的路由鍵(可選)
參考文獻:code
https://www.jianshu.com/p/451958b1adcablog