I was trying it only with python on my MRG-M 2.2 / Qpid 0.14 broker and it
worked fine. Maybe something changed between 0.14 and 0.18.
I created the queue like this:
qpid-config -a admin/admin@rgc001:21313 add queue testP
--argument=qpid.priorities=10
and afterwards tested it with following python client:
#! /usr/bin/python
from qpid.messaging import *
from qpid.log import enable, DEBUG
import time
import random
send_address = "testP; { node: { type: queue }, create: never }"
receive_adress = "testP; { create: never, node: { type: queue } }"
connection = Connection(host="rgc001", port=21313, username="admin",
password="admin")
try:
connection.open()
session = connection.session()
sender = session.sender(send_address)
receiver = session.receiver(receive_adress)
for i in range(1, 10):
prio = random.randint(1,10)
message = Message("Priority " + str(prio), durable=True, priority=prio)
print ""
print "SENDING PRIO MESSAGE ", i
print "####################"
print "Priority: ", message.priority
print "Content: ", message.content
sender.send(message, sync=False, timeout=1000);
sender.sync(1000)
print ""
print "Sending finished ... receiving ..."
print ""
time.sleep(10)
for i in range(1, 10):
message = receiver.fetch(timeout=None)
print ""
print "RECEIVING PRIO MESSAGE ", i
print "####################"
print "Priority: ", message.priority
print "Content: ", message.content
session.acknowledge()
sender.sync(1000)
except MessagingError,m:
print m
finally:
connection.close()
On Thu, Feb 28, 2013 at 11:16 AM, Aleš Trček <[email protected]> wrote:
> Thanks for the suggestion, however this does not seem to work. Queue is
> created, messages can be exchanged, but I receive them FIFO not sorted by
> priority. With message.getJMSPriority() I can see the priorities I had set,
> so that is OK. It's just that the queue is not a priority queue. Any other
> insights into this priority stuff on C++ broker? :)
>
> >Hi Aleš,
> >
> >I think you can use the --argument=<NAME=VALUE> option of the qpid-config
> to specify the number of priorities. It is a long time since I used it, but
> I believe it should >be something like ...
> > --argument=qpid.priorities=10
> >... to specify that you want the queue to distinguish 10 priority levels.
> >
> >I'm not sure why the priority queues seem to be missing in the Qpid
> documentation - Red Hat MRG-M documentation seems to contain some more
> details about it (>
> https://access.redhat.com/knowledge/docs/en-US/Red_Hat_Enterprise_MRG/2/html/Messaging_Programming_Reference/sect-Priority_Queuing.html
> ).
> >I'm not sure whether this means that the functionality has been removed
> since 0.14.
> >
> >Regards
> >Jakub
> >
> >On Wed, Feb 27, 2013 at 4:46 PM, Aleš Trček <[email protected]> wrote:
> >
> >> re is no trace of priority queues. How can I create one, or i
>