Setting Priority queue in RabbitMq using PIKA (python client for rabbit mq)

3,474 views
Skip to first unread message

naveen pajjuri

unread,
Sep 20, 2015, 8:04:59 AM9/20/15
to rabbitmq-users
Hello,
Im using pika (python client for rabbit mq). i wanted to send messages with priority.
so all im doing is 
channel.queue_declare(queue='hello',arguments=data)
where my data is 

data = dict()
data['x-max-priority'] = 7

but i'm getting the following error 

inequivalent arg 'x-max-priority' for queue 'hello' in vhost '/': received the value '7' of type 'signedint' but current is none")

some one please help me.

Thanks in Advance.

Giuseppe Privitera

unread,
Sep 20, 2015, 8:18:39 AM9/20/15
to naveen pajjuri
Hi Naveen,

Make sure your publisher and subscribers declare the queue with the same x-max-priority value.

Kind regards,
Giuseppe

Sent from my BlackBerry 10 smartphone on the O2 network.
From: naveen pajjuri
Sent: Sunday, 20 September 2015 13:05
To: rabbitmq-users
Subject: [rabbitmq-users] Setting Priority queue in RabbitMq using PIKA (python client for rabbit mq)

--
You received this message because you are subscribed to the Google Groups "rabbitmq-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-user...@googlegroups.com.
To post to this group, send email to rabbitm...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

naveen pajjuri

unread,
Sep 20, 2015, 8:40:13 AM9/20/15
to rabbitmq-users
rabbit.py

naveen pajjuri

unread,
Sep 20, 2015, 8:41:50 AM9/20/15
to rabbitmq-users
also im attaching my code and error.

 11147@EN-PajjuriN:~/solrscripts$python rabbit.py

Traceback (most recent call last):

  File "rabbit.py", line 18, in <module>

    channel.queue_declare(queue='hello',arguments=data)

  File "/Library/Python/2.7/site-packages/pika/adapters/blocking_connection.py", line 2329, in queue_declare

    self._flush_output(declare_ok_result.is_ready)

  File "/Library/Python/2.7/site-packages/pika/adapters/blocking_connection.py", line 1181, in _flush_output

    raise exceptions.ChannelClosed(method.reply_code, method.reply_text)

pika.exceptions.ChannelClosed: (406, "PRECONDITION_FAILED - inequivalent arg 'x-max-priority' for queue 'hello' in vhost '/': received the value '7' of type 'signedint' but current is none")

Thanks in advance.

rabbit.py

Alvaro Videla

unread,
Sep 20, 2015, 2:19:16 PM9/20/15
to rabbitm...@googlegroups.com
Perhaps you declared the queue first without the 'x-max-priority' header, and then you tried to re-declare the queue by adding it? If that's the case, then first delete the old queue, and then redeclare it with the 'x-max-priority' header. Note that deleting a queue will also delete its messages.

--

naveen pajjuri

unread,
Sep 21, 2015, 3:09:52 AM9/21/15
to rabbitmq-users
@Alvaro Videla 

Thanks for the reply. issue got resloved.
Reply all
Reply to author
Forward
0 new messages