rocketmq整合mysql_Springboot2整合RocketMQ消费端

1、创建springboot2项目,省略;

2、pom.xml引用

org.apache.rocketmq

rocketmq-spring-boot-starter

2.0.4

3、yml配置文件

rocketmq:

name-server: 127.0.0.1:9876

producer:

group: base_group_syncMsg

send-message-timeout: 5000

retry-times-when-send-failed: 2

max-message-size: 4194304

4、Consumer.java文件

/**

* @Author: Liu Yue

* @Descripition: 排序消费

* @Date; Create in 2020/11/22 19:30

**/

@Component

@RocketMQMessageListener(topic = "base_topic", selectorExpression = "base_tags", consumerGroup = "base_group",consumeMode = ConsumeMode.ORDERLY)

@Slf4j

public class Consumer implements RocketMQListener {

@Override

public void onMessage(String msg) {

log.info("读取消息:{}",msg);

}

}

每日提高一点点!!!

你可能感兴趣的:(rocketmq整合mysql)