提交 12214289 编写于 作者: 武汉红喜's avatar 武汉红喜

rocketmq-spring

上级 93b720c5
......@@ -7,7 +7,7 @@ import org.springframework.context.support.ClassPathXmlApplicationContext;
*/
public class Consumer {
public static void main(String[] args) {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("rocketmq-consumer.xml");
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("mq-consumer.xml");
context.registerShutdownHook();
}
}
......@@ -10,11 +10,11 @@ import org.springframework.context.support.ClassPathXmlApplicationContext;
public class Producer {
public static void main(String[] args) {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("rocketmq-producer.xml");
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("mq-producer.xml");
RocketMQTemplate rocketMQTemplate = (RocketMQTemplate) context.getBean("rocketMQTemplate");
for (int i = 0; i < 20; i++) {
try {
SendResult sendResult = rocketMQTemplate.send("sdk-test", "rocketMQTemplate");
SendResult sendResult = rocketMQTemplate.send("ROCKETMQ_SPRING_TEST", "rocketMQTemplate");
System.out.println(sendResult);
} catch (Exception e) {
e.printStackTrace();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册