Open markohaapala opened 8 years ago
Any luck with this? I am working to try and do the same thing.
This is how I got it to work. The 'arguments' and 'routingKey' were the key changes. I hope this helps.
48 var options = {
49 exchange: 'payment.ex',
50 routingKey: 'payment.new.' + priority,
51 queue: {
52 name: 'payment.q',
53 deadLetter: 'payment.dlx',
54 noBatch: true,
55 limit: Number(limit),
56 maxPriority: 4
57 },
58 arguments: {
59 'x-priority': priority
60 }
61 };
62 Rabbus.Receiver.call(this, rabbot, options);
Hi,
I've struggled with getting messages prioritized in RabbitMQ using Rabbus send-receive pattern. I create the exchange like this:
And in the Sender I set a priority in the middleware depending on how the Sender was initialized:
I can see in RabbitMQ console that the queue has x-max-priority set to 4, and in the messages I see the header x-priority as 1 or 2, depending on how the Sender was initialized.
The queue will however be processed sequentially in the order that the payments are received. My guess is that I'm missing something fundamental. Other than configuring the exchange, I couldn't find any references of defining message priorities in RabbitMQ layout book, RMQ Patterns book, rabbus source code or through google, so this is my last hope to get some guidance.
EDIT: I'm using