RocketMQ 一个topic 多个消费者只有一个消费的问题

2020-08-25  本文已影响0人  索性流年

前言

原因

解决方法

案例

rocketmq:
  name-server: 192.168.112.140:9876
  producer:
    group: member_synchronization_group
@Service
@RocketMQMessageListener(topic = "mysql-redis-topic", consumerGroup = "member_synchronization_group")
public class MemberListener implements RocketMQListener<String> {
    @Autowired
    private RedisUtil redisUtil;
    @Override
    public void onMessage(String message) {
        System.out.println("接收消息:" + message);
    }
}

rocketmq:
  name-server: 192.168.112.140:9876
  producer:
    group: goods_synchronization_group
@Service
@RocketMQMessageListener(topic = "mysql-redis-topic", consumerGroup = "goods_synchronization_group")
public class GoodsListener implements RocketMQListener<String> {
    @Autowired
    private RedisUtil redisUtil;
    @Override
    public void onMessage(String message) {
        System.out.println(message);
    }
}

上一篇下一篇

猜你喜欢

热点阅读