event-handling - How do I configure Event Processors in Axon with Spring?
问题描述
Apparently Axon uses TrackingEventProcessors
by default. I would like to use SubscribingEventProcessors
instead. The docs say that the latter is already the default, but they seem to be outdated.
By default, Axon will use Subscribing Event Processors. It is possible to change how Handlers are assigned and how processors are configured using the EventHandlingConfiguration class of the Configuration API.
For instance, it is suggested to perform configurations like so:
@Autowired
public void configure(EventHandlingConfiguration config) {
config.usingTrackingProcessors(); // default all processors to tracking mode.
}
However, there is no EventHandlingConfiguration
in v4 (there was in v3).
I need to use the SubscribingEventProcessors
to perform read-model updates in the same transaction as command handling. How can this be configured in 4.0?
解决方案
事件处理器的这方面可以配置为application.yml/application.properties
axon:
eventhandling:
processors:
NAME_OF_THE_PROCESSOR:
mode: subscribing
我想你是对的。文档引用了旧 API。
您可以将所有事件处理器构建器配置为使用 SubscribingEventProcessor
@Autowired
public void configure(EventProcessingConfigurer configurer) {
configurer.usingSubscribingEventProcessors();
}
最好的,伊万
推荐阅读
- php - 在 AJAX 调用中使用 Auth::attempt() 进行 Laravel 身份验证
- sql - PostgreSQL 格式时间戳,h:mm am/pm
- go - Go接口:无法为未导出的字段赋值
- unity3d - Unity Sprite 镜像重复
- javascript - XMLHttpRequest readyState 停留在 1 并且永远不会达到 4
- r - 按字符和缺失条件计算每行的列数
- java - 移动物体的漫射照明
- android-studio - 是否可以在 Android Studio 中看到 Gerrit 插件的评论?
- python - 使嵌套字典输出不那么复杂
- python-3.x - 如何用熊猫提取最大长度行