[rabbitmq-discuss] pika error - need a help
Ann Witbrock (c)
awitbrock at vmware.com
Wed Sep 7 12:21:16 BST 2011
Hi Sergey,
I'm not the most experienced about the pika, but I would recommend using normal E xception handling around the connection and queue set up , and also around your processing code, so that it doesn't interfere with the normal running of the processing. If you record the exception messages somewhere, you will be able to get more inf ormation about the failure.
Your exact needs may differ, but our java tutorial at https://github.com/rabbitmq/rabbitmq-tutorials/blob/master/java/RPCServer.java has some Exception context (the "try" blocks) which may be helpful. Unfortunately, we don't have such an example for the pika.
I hope to add some guidance on exceptions to our documentation at some point soon.
Ann
----- Original Message -----
From: "Sergey Almazov" <sergey.almazoff at gmail.com>
To: rabbitmq-discuss at lists.rabbitmq.com
Sent: Wednesday, 7 September, 2011 6:39:59 AM
Subject: [rabbitmq-discuss] pika error - need a help
#!/usr/bin/env python
import pika
import sys
import psutil
import json
import time
serverName = "salmazov"
connection = pika.AsyncoreConnection(pika.ConnectionParameters(host='192.168.0.25'))
channel = connection.channel()
channel.exchange_declare(exchange='cmd', type='topic')
cmd_data_queue = channel.queue_declare(exclusive=True).queue
channel.queue_bind(exchange='cmd', queue=cmd_data_queue, routing_key='cmd.*')
def callback(ch, method, properties, body):
print " [x] %r:%r" % (method.routing_key, body,)
procCmd = decodeddict["ProcCmd"]
proc = psutil.Popen(procCmd)
channel.basic_consume(callback, queue=cmd_data_queue, no_ack=True)
pika.asyncore_loop()
--------------------------------------------
When I start this code -> have an error: error: uncaptured python exception, closing channel <pika.asyncore_adapter.RabbitDispatcher connected at 0x12ad6c0>
I need to run processes that arrived via RmQ
_______________________________________________
rabbitmq-discuss mailing list
rabbitmq-discuss at lists.rabbitmq.com
https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20110907/c66bcda8/attachment.htm>
More information about the rabbitmq-discuss
mailing list