for (int j = 0; j < num; j++) {
// ��Ҫ����topic
this.producerList.get(j).publish(topic1);
for (int i = 0; i < count; i++) {
final byte[] data = ("hello" + j + i).getBytes();
final Message msg;
if (attributed == true) {
msg = new Message(topic1, data, attributed1);
}
else {
msg = new Message(topic1, data);
}
final SendResult result = this.producerList.get(j).sendMessage(msg);
if (!result.isSuccess()) {
throw new RuntimeException("Send message failed:" + result.getErrorMessage());
}
this.messages.add(msg);
}
}
for (int j = 0; j < num; j++) {
// ��Ҫ����topic
this.producerList.get(j).publish(topic2);
for (int i = 0; i < count; i++) {
final byte[] data = ("hello" + i + j).getBytes();
final Message msg;
if (attributed == true) {
msg = new Message(topic1, data, attributed2);
}
else {
msg = new Message(topic1, data);
}
final SendResult result = this.producerList.get(j).sendMessage(msg);
if (!result.isSuccess()) {
throw new RuntimeException("Send message failed:" + result.getErrorMessage());
}