【问题标题】:Using RabbitListener annotation to create priority queues in Spring Boot在 Spring Boot 中使用 RabbitListener 注解创建优先级队列
【发布时间】:2020-11-19 16:16:25
【问题描述】:
@RabbitListener(bindings = @QueueBinding(value = @Queue(value = "${queue}",
                durable = "true", autoDelete = "false",
                exchange = @Exchange(value = "${exchange}"),
                key = "${binding}"),concurrency = "${concurrency}")

这会创建一个队列,我该如何创建一个优先级队列?

【问题讨论】:

    标签: spring-boot rabbitmq spring-rabbit


    【解决方案1】:

    所以我发现应该删除现有队列以及交换。下面的代码创建了一个优先级队列。我在网上找了这个,但找不到任何答案。所以,我在这里发布。

    @RabbitListener(bindings = @QueueBinding(value = @Queue(value = "${queue}",
                    durable = "true", autoDelete = "false",
                    arguments = {@Argument(name = "x-max-priority", value = "10",
                    type = "java.lang.Integer")}),
                    exchange = @Exchange(value = "${exchange}"),
                    key = "${binding}"),concurrency = "${concurrency}")
    

    【讨论】:

    • 您应该将此自我回答标记为已接受 - 点击复选标记。
    • 它说我可以在 1 天后接受这个答案,但现在不能。
    猜你喜欢
    • 2019-03-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-12-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多