According to the document, priority-adjustment means
when a consumer attaches its priority is used to make the upstream consumer, but with an adjustment by default -1, so that local consumers get load balanced first over remote, this enables this to be configurable should it be wanted/needed.
Therefore, priority-adjustment can control the direction of data flow. When priority adjustment = -1, the broker will first transmit the data to the remote instead of using it locally.
Migrating between two clusters. Consumers and publishers can be moved in any order and the messages won't be duplicated (which is the case if you do exchange federation). Instead, messages are transferred to the new cluster when your consumers are there. Here for such a migration with blue/green or canary moving a number of consumers on the same queue, you may want to set the priority-adjustment to 0, or even a positive value, so message would actively flow to the federated queue.
Does this mean that when the priority is adjusted to an integer greater than or equal to zero, once the remote consumer being generated, the broker will be more willing to transmit the message to the remote consumer rather than the local consumer? What happens if the priority is negative under two clustering conditions? I have also seen some samples adjust the priority to a value other than -1/0, I don't know how this value works. I also found some documents about ActiveMQ message priority setting, which does not seem to apply to Artemis. Please tell me more details about the meaning of the parameter "priority-adjustment".
ActiveMQ Artemis retrieves messages from upstream queues in order to satisfy demand for messages from local consumers connected to a federated queue.
To retrive messages from upstream queues it creates a remote consumer using the priority of the local consumer adjusted with the priority-adjustment value adjustedPriority = consumer.getPriority() + priorityAdjustment
.
The adjusted priority of the remote consumer works as the consumer priority of local consumers attached to the upstream queue. Messages will only going to lower priority consumers when the high priority consumers do not have credit available to consume the message, or those high priority consumers have declined to accept the message.
If all consumers (upstream and downstream) have the same priority. The local consumers should receive the messages first then remote consumers when priority adjustment = -1.