Does RabbitMQ have any concept of message priority? I have an issue were some more important messages are being slowed down due to less important messages sitting before it
Yes, RabbitMQ supports priority queues.
To make a queue work as a priority queue, supply property x-max-priority when declaring the queue.
Property x-max-priority defines the maximum priority number the queue supports.
In Java, you can do like below:
Map props = new HashMap<>();
props.put("x-max-priority", 10); // max priority number as 10
channel.queueDeclare(QUEUE_NAME, durable, false, false, props);
To publish messages of a particular priority, do like below:
String message = "My message with priority 7";
AMQP.BasicProperties.Builder basicProps = new AMQP.BasicProperties.Builder();
basicProps.contentType("text/plain")
.priority(7);
channel.basicPublish("", QUEUE_NAME, basicProps.build(), message.getBytes());