阿里云kafka使用springboot单个项目中同时消费不同topic

在SpringBoot项目中,尝试让一个应用同时消费Kafka的两个不同Topic时遇到了问题。当一个Topic使用默认消费方式,另一个指定了特定Partition时,出现提交Offset错误。经过排查,尝试了设置监听器ID、开启多线程和更改clientId,最终发现错误源于相同的groupId。通过为每个Topic分配不同的groupId,成功解决了问题,实现了正常消费。
摘要由CSDN通过智能技术生成

本来是个简单的问题,但是复杂了。

两个topic 消费方式不一样,一个使用过的是默认方式,不指定partition,另外一个,指定了特殊的partition。报错:

11:10:32.888 [org.springframework.kafka.KafkaListenerEndpointContainer#1-0-C-1] 
ERROR o.a.k.c.c.i.ConsumerCoordinator - 
[Consumer clientId=futures_deal_group-1302249340-0, groupId=deal_group] 
Offset commit failed on partition topic-depth-6 at offset 1535688270: The coordinator is not aware of this member

11:10:32.888 [org.springframework.kafka.KafkaListenerEndpointContainer#1-0-C-1] 
WARN  o.a.k.c.c.i.ConsumerCoordinator - 
[Consumer clientId=futures_deal_group-1302249340-0, groupId=deal_group] 
Asynchronous auto-commit of offsets {topic-depth-6=OffsetAndMetadata{offset=1535688270, metadata=''}} 
failed: Commit cannot be completed since the group has already rebalanced and assigned the partitions to another member. This means that the time between subsequent c
alls to poll() 
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值