Azam M
Azam M

Reputation: 93

Using RabbitListener annotation to create priority queues in Spring Boot

@RabbitListener(bindings = @QueueBinding(value = @Queue(value = "${queue}",
                durable = "true", autoDelete = "false",
                exchange = @Exchange(value = "${exchange}"),
                key = "${binding}"),concurrency = "${concurrency}")

This creates a queue, how do I go about creating a priority queue?

Upvotes: 1

Views: 1072

Answers (1)

Azam M
Azam M

Reputation: 93

So I found that the existing queues should be deleted and the exchanges as well. And the following code creates a priority queue. I looked for this online, but couldn't find any answers. So, I am posting this here.

@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}")

Upvotes: 4

Related Questions