Closed PhantomRay closed 2 years ago
If I change the the second one to priority queue consumer.consume('queue2', true, anotherMessageHandler,..., I run it for a few times, I always get this result:
You have enabled priority queuing for the message handler on queue2
. Great! But no messages with priority has been produced.
I always thought by enabling that, messages will pop out from the queue base on their priority. Messages with the same priority will pop out LIFO.
But why does the queue hold the messages? Can you please explain?
I always thought by enabling that, messages will pop out from the queue base on their priority.
Based on what priority? Have you set the priority for the message? Please read carefully the docs.
To set up a priority for a message you use Message.prototype.setPriority()
From that point the message is enqueued to a priority queue. Messages without priority can not be consumed with a priority.
I misunderstood
I'm glad you figure it out
Closing as resolved.
Hi there
For the code above, both queues are not priority queue. The output will be always:
If I change the the second one to priority queue
consumer.consume('queue2', true, anotherMessageHandler,...
, I run it for a few times, I always get this result:If I set priority back to false for the second queue, I got this output:
My question is, when I use
consumer.consume('queue2', true, anotherMessageHandler,...
, why couldn't I consume the messages from 2nd queue?