使用eventlet并发consumer脚本:
def __init__(self, count):
self.queue_name = 'test_queue%d' % count
self.i=0
self.a=None
self.b=None
server = {'host':rabbit_host, 'userid':'guest',
'password':'guest', 'ssl':False}
self.conn = amqp.Connection( server['host'],
userid=server['userid'],
password=server['password'],
ssl=server['ssl'])
self.ch = self.conn.channel()
self.ch.access_request('/data', active=True, read=True)
self.ch.exchange_declare(exchange='rabbit_test_concurrent',
type='topic', durable=True,
eventlet.monkey_patch(all=True)
msg_per_queue = 50
queue_num = 10
rabbit_host = '10.23.54.150:5672'
class Consumer():