2 # -*- coding: utf-8 -*-
4 # Display the contents of the queues.
6 # Note this cannot display messages which are being processed.
8 # This works by fetching the messages without acknowledging them,
9 # effectively peeking into the queues.
17 connection = pika.BlockingConnection(pika.ConnectionParameters(
18 host = config.mq_server))
19 channel = connection.channel()
21 print "patchq_input (Unordered messages):"
23 method, _, body = channel.basic_get(queue = 'patchq_input', no_ack = False)
25 m = email.message_from_string(body) # the email
26 # Only display the subject line.
27 print (" %s" % m['Subject'])
29 for t in config.tests:
30 qname = "patchq_test_%s" % t
31 print ("%s (Threads queued for %s):" % (qname, t))
33 method, _, body = channel.basic_get(queue = qname, no_ack = False)
36 msgs = json.loads(body)
37 msgs = [email.message_from_string(m) for m in msgs]
41 print (" %s" % m['Subject'])
43 print "patchq_reports (Reports):"
45 method, _, _ = channel.basic_get(queue = 'patchq_reports', no_ack = False)
48 to, subject, ref, content = json.loads(body)
50 print (" %s" % subject)
53 print "Note that messages being processed are not displayed. To see all"
54 print "messages use ‘rabbitmqctl list_queues’ and other RabbitMQ admin tools."