天天看点

【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 事件中所引发异常的代码后,就可以解决此问题。

【Azure 事件中心】EventHub 中同一条消息不停的推送给消费端问题记录

参考资料

Event Hub CheckPoint: https://docs.azure.cn/zh-cn/event-hubs/event-hubs-features#checkpointing

当在复杂的环境中面临问题,格物之道需:浊而静之徐清,安以动之徐生。 云中,恰是如此!

继续阅读