Axon配置 – 在@eventhandlers抛出异常后的Kafka重试策略

huangapple go评论88阅读模式
英文:

Axon Config - Kafka retry policies after @eventhandlers thrown exception

问题

我已经开始在我的项目中使用Axon 4.3.1(最新版本),并遇到了一个问题。

在@eventhandler抛出异常后,我在哪里可以配置Kafka的重试策略?

注意:我正在使用SubscribingEventProcessor作为事件处理器类型(两个项目都是)。我在单独的项目中使用!命令模型使用mongo在Kafka上发布事件。查询模型从Kafka(事件总线)中消耗事件。因此,使用单独的JVM。

@processinggroup(事件处理器)被配置为具有事件处理方法的类。我希望在查询模型项目中的错误情况下,对Kafka进行自动重试。

我可以使用一些默认的Axon组件吗?我可以使用类似于spring-retry或内部kafka配置吗?

我找到了类似于以下内容的文档:

https://docs.axoniq.io/reference-guide/configuring-infrastructure-components/event-processing/event-processors#error-handling

“根据提供的ErrorContext对象,您可以决定忽略错误,安排重试,执行死信队列传递或重新抛出异常。”

我该如何在错误后进行配置(例如,安排重试)在@eventhandler上?

您能帮助我吗?

谢谢。

英文:

I've started to use Axon 4.3.1 (latest version) in my project and having a problem.

Where can I config the kafka retry policies after @eventhandler throw an exception?

OBS: I'm using SubscribingEventProcessor type as event processor (both projects). I'm using separate projects! Command model use mongo and publish events on Kafka. Query model consume events from Kafka (eventbus). In this way, using separate JVMs.

@processinggroup(event-processor) is configured to class with event-handler method. I'd like to have a config to Kafka auto retry after some time in error cases (from query model project).

Can I use some default Axon component? Could I use something like spring-retry or internal kafka configs itself?

I've found something like that (documentation):

https://docs.axoniq.io/reference-guide/configuring-infrastructure-components/event-processing/event-processors#error-handling

"Based on the provided ErrorContext object, you can decide to ignore the error, schedule retries, perform dead-letter-queue delivery or rethrow the exception."

How can I config (for example, schedule retries) on @eventhandler after errors?

Could you help me?

Thanks.

答案1

得分: 0

Axon的Kafka扩展当前实现(版本4.0-M2)不支持在事件处理方面设置重试策略。

我认为你现在最好的方法是在Kafka上设置类似的东西,如果可能的话。否则,强制通过Kafka重新播放事件可能是你最好的方法。

英文:

The current implementation of Axon's Kafka Extension (version 4.0-M2) does not support setting a retry policy when it comes to event handling.

I'd argue your best approach right now is to set up something like that on Kafka, if that's even possible. Otherwise, forcing a replay of the events through Kafka would be your best approach.

huangapple
  • 本文由 发表于 2020年4月9日 08:16:07
  • 转载请务必保留本文链接:https://go.coder-hub.com/61112008.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定