【Azure 事件中心】EventHub 中同一条消息不停的推送给消费端问题记录
问题描述
EventHub 中同一条消息,不停的推送给消费端,查看日志发现错误:
Caused by: com.azure.messaging.eventhubs.implementation.PartitionProcessorException: Error in event processing callback at com.azure.messaging.eventhubs.PartitionPumpManager.processEvent(PartitionPumpManager.java:280) at com.azure.messaging.eventhubs.PartitionPumpManager.processEvents(PartitionPumpManager.java:314) ... 12 common frames omitted Caused by: org.springframework.jdbc.BadSqlGrammarException: ### Error querying database. Cause: org.postgresql.util.PSQLException: ERROR: column "messageeventcode" does not exist Hint: Perhaps you meant to reference the column "event_code". Position: 2209 ### The error may exist in file [D:\home\site\wwwroot\webapps\xxxxxx.xml] ### The error may involve defaultParameterMap ### The error occurred while setting parameters
问题分析
在客户端的日志中,发现消费端每一分钟都会与处理器(process event )建立,而消费端连接后,都会通过Storage Account上存储的检查点(Checkpoint)来开始消费消息,而发现检查点一直都是同一个位置Starting event processing from offset[xxxx244317],随后就出现了 Exception: Error in event processing callback 异常,导致消费端的这个进程关闭: Closing partition processor for partition 1 with close reason LOST_PARTITION_OWNERSHIP。
这个错误由接收事件时的错误或on_event中的错误引起,关闭了处理器连接,之后重新建立的连接还是从Starting event processing from offset[xxxx244317]开始的,所以导致一直消费相同的数据。只要解决了 PARTITION_PROCESSOR 事件中所引发异常的代码后,就可以解决此问题。
参考资料
Event Hub CheckPoint: https://docs.azure.cn/zh-cn/event-hubs/event-hubs-features#checkpointing
当在复杂的环境中面临问题,格物之道需:浊而静之徐清,安以动之徐生。 云中,恰是如此!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?
2021-01-31 【Azure 应用服务】Azure App Service (Windows) 使用Flask框架部署Python应用,如何在代码中访问静态文件呢?如何设置文件路径?是相对路径还是绝对路径呢?