parent
1435ee76c1
commit
6486102c82
Binary file not shown.
Binary file not shown.
@ -1,12 +0,0 @@
|
||||
<License>
|
||||
<Data>
|
||||
<Products>
|
||||
<Product>Aspose.Total for Java</Product>
|
||||
</Products>
|
||||
<EditionType>Enterprise</EditionType>
|
||||
<SubscriptionExpiry>20991231</SubscriptionExpiry>
|
||||
<LicenseExpiry>20991231</LicenseExpiry>
|
||||
<SerialNumber>8bfe198c-7f0c-4ef8-8ff0-acc3237bf0d7</SerialNumber>
|
||||
</Data>
|
||||
<Signature>sNLLKGMUdF0r8O1kKilWAGdgfs2BvJb/2Xp8p5iuDVfZXmhppo+d0Ran1P9TKdjV4ABwAgKXxJ3jcQTqE/2IRfqwnPf8itN8aFZlV3TJPYeD3yWE7IT55Gz6EijUpC7aKeoohTb4w2fpox58wWoF3SNp6sK6jDfiAUGEHYJ9pjU=</Signature>
|
||||
</License>
|
@ -1,27 +0,0 @@
|
||||
package UnitTest;
|
||||
import org.apache.rocketmq.client.producer.DefaultMQProducer;
|
||||
import org.apache.rocketmq.client.producer.SendResult;
|
||||
import org.apache.rocketmq.common.message.Message;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @Date 2021-04-20 15:40
|
||||
*/
|
||||
public class Producer {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
//声明发送者
|
||||
DefaultMQProducer producer = new DefaultMQProducer("default_producter_group");
|
||||
producer.setNamesrvAddr("10.10.14.231:9876");
|
||||
producer.start();
|
||||
//发送
|
||||
String body = "你好 RocketMQ";
|
||||
Message message = new Message("TopicXuanKe", null, body.getBytes());
|
||||
message.setKeys(UUID.randomUUID().toString());
|
||||
SendResult sendResult = producer.send(message);
|
||||
System.out.printf("发送结果:%s%n", sendResult);
|
||||
//关闭生产者
|
||||
producer.shutdown();
|
||||
}
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
package UnitTest;
|
||||
|
||||
import org.apache.rocketmq.client.producer.DefaultMQProducer;
|
||||
import org.apache.rocketmq.client.producer.SendResult;
|
||||
import org.apache.rocketmq.common.message.Message;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @Date 2021-04-20 15:40
|
||||
*/
|
||||
public class TestRocketMqProducer {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
//声明发送者
|
||||
DefaultMQProducer producer = new DefaultMQProducer("default_producter_group");
|
||||
producer.setNamesrvAddr("10.10.14.169:9876");
|
||||
producer.start();
|
||||
//发送
|
||||
//43778 ms
|
||||
long startTime = System.currentTimeMillis();
|
||||
for (int i = 1; i <= 100000; i++) {
|
||||
String body = "I am ChengXuYuan!Hello World!" + i;
|
||||
Message message = new Message("name", null, body.getBytes());
|
||||
message.setKeys(UUID.randomUUID().toString());
|
||||
SendResult sendResult = producer.send(message);
|
||||
}
|
||||
long endTime = System.currentTimeMillis();
|
||||
long totalTime = endTime - startTime;
|
||||
System.out.println(totalTime);
|
||||
//System.out.printf("发送结果:%s%n", sendResult);
|
||||
//关闭生产者
|
||||
producer.shutdown();
|
||||
}
|
||||
}
|
Loading…
Reference in new issue