System.out.println("starting producer #" + i);
Connection conn = factory.newConnection();
producerConnections[i] = conn;
Channel channel = conn.createChannel();
if (producerTxSize > 0)
channel.txSelect();
channel.exchangeDeclare(exchangeName, exchangeType);
final Producer p = new Producer(channel, exchangeName, id, flags, producerTxSize,
1000L * samplingInterval, rateLimit, minMsgSize, timeLimit, messageCount);
channel.addReturnListener(p);
Thread t = new Thread(p);