似乎从spring-amqp 1.5版本开始,有一个新的注解@queuebinding。但是如何使用它,我不知道它是否可以在类或方法上使用?是否存在任何示例?
最佳答案
不知道您遇到什么问题,但这是Reference Manual的一个示例:
@Component
public class MyService {
@RabbitListener(bindings = @QueueBinding(
value = @Queue(value = "myQueue", durable = "true"),
exchange = @Exchange(value = "auto.exch"),
key = "orderRoutingKey")
)
public void processOrder(String data) {
...
}
是的,它既可以在类级别也可以在方法级别使用。
关于rabbitmq - 如何在@rabbitlistener中使用@queuebinding?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33239347/