Closed GoogleCodeExporter closed 9 years ago
Add a patch for d2lAgentConsume.py to handle TypeError exception.
def rough_connect(parameters,on_connected,srs):
connection = SelectConnection(parameters, on_open_callback=on_connected, reconnection_strategy=srs)
try:
# Loop so we can communicate with RabbitMQ
connection.ioloop.start()
except KeyboardInterrupt:
# Gracefully close the connection
connection.close()
# Loop until we're fully closed, will stop on its own
connection.ioloop.start()
except Exception as inst:
print "Encounter exception " + str(inst) + " create another connection"
rough_connect(parameters,on_connected,srs)
def fetch_job(d2l_agent):
global agent
agent = d2l_agent
agent.log.info('post_job(): MQ Parameter setup')
credentials = pika.PlainCredentials( agent.mq_username, agent.mq_password)
parameters = pika.ConnectionParameters(
host = agent.mq_hostname,
credentials = credentials,
virtual_host = agent.mq_vhost)
#heartbeat = True
agent.log.info('post_job(): Setting-up connection, host: ' + agent.mq_hostname )
# Step #1: Connect to RabbitMQ
srs = SimpleReconnectionStrategy()
rough_connect(parameters,on_connected,srs)
Original comment by lockon...@gmail.com
on 10 Feb 2012 at 11:27
Original issue reported on code.google.com by
lockon...@gmail.com
on 9 Feb 2012 at 11:45