gpt4 book ai didi

java - Axon 框架的真实生活体验

转载 作者:IT老高 更新时间:2023-10-28 20:41:08 26 4
gpt4 key购买 nike

作为研究用于项目的 CQRS 的一部分,我遇到了 Axon Framework ,我想知道是否有人对它有任何真实的生活经验。为了清楚起见,我问的是框架,而不是 CQRS 作为架构模式。

我的项目已经使用了 Spring 和 Spring Integration,它非常适合 Axon 自己的需求,但在我投入大量时间之前,我想知道是否有人有一些第一手经验。特别是我对文档中没有立即显现的可能陷阱感兴趣。

最佳答案

The framework relies heavily on eventsourcing, which means that all state changes are >written to the data store as events. "

这完全不正确,它并没有严重依赖事件溯源。在此框架中存储聚合的实现之一使用事件溯源,但您也可以轻松地使用提供的类来使用标准关系模型。

事件溯源会更好。

So you have a historical reference of all your data. This is nice but makes changing your >domain after you've gone in production a very daunting proposition especially if you sold >the customer on the system's "strong auditability" "

我认为使用仅存储当前状态的标准关系模型并不容易。

The framework encourages denormalizing your data, to the point that some have suggested >having a table per view in the application. This makes your application extremely >difficult to maintain, especially when the original developers are gone"

这与框架无关,而是与使用中的架构模式 (CQRS) 相关。很抱歉,但拥有一个非规范化器/ View 是个好主意,因为它仍然是一个简单的对象。

因此维护很容易,因为 SQL 请求/插入也很容易。所以这个论点不是很强。一个使用 1000 个表模型的 View 如何,该模型具有无处不在的内部连接和复杂的 SQL 查询?

CQRS 再次提供帮助,因为基本上, View 数据只是表中对应于 View 的 SELECT *。

if somehow you made a mistake in one of the eventhandlers, your only option is to >"replay" the eventlog, which depending on the size of your data can take a very long >time. The tooling for this however is non-existent.

我同意目前缺乏回放事件的工具并且这可能需要很长时间的观点。但是,理论上可以只重放事件的一部分,而不是事件存储的所有内容。

Replaying can have side effects, so >developers become scared of doing it

重放事件有副作用 -> 这是不正确的。对我来说,副作用意味着修改系统的状态。在事件源 CQRS 应用程序中,状态存储在事件存储中。重放事件不会修改事件存储。您可以对模型的查询端产生副作用是的。但是您不在乎是否犯了错误,因为您仍然可以纠正错误并再次重播该事件。

it's extremely easy to have developers mess up using this framework. if they don't store >changes to domain objects in events, next time you replay your events you are in for a >surprise.

好吧,如果您误用和误解了架构、概念等,那么好吧,我同意您的看法。但也许问题不在于这里的框架。

Should you store delta's ? absolute values ? if you don't keep tabs on your developers >you are bound to end up with both and you will be f***ed

我可以说,对于每个系统,我都会说它与框架本身没有直接关系。这就像说,“Java 是垃圾,因为如果有人编写了错误的 hashCode 和 equals 方法实现,你可能会搞砸一切。”

对于您评论的最后一部分,我已经看到了带有 Spring 框架的 helloWorld 等示例。当然在一个简单的例子中它是完全没用的。

在您的评论中要小心,以便在概念(CQRS + EventSourcing)和框架之间有所区别。请有所作为。

关于java - Axon 框架的真实生活体验,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9646884/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com