【问题标题】:Trying to use subscribing event processor and tracking event processor in axon config together尝试在轴突配置中一起使用订阅事件处理器和跟踪事件处理器
【发布时间】:2021-08-20 10:24:41
【问题描述】:

我正在尝试在 Axon 配置中一起使用订阅事件处理器和跟踪事件处理器,但没有成功。我只能使用订阅事件处理器。

我正在使用带有 Spring Boot 的 Axon Framework 4.x 版本

@Autowired
public void registerTrackingProcessorConfig(EventProcessingConfigurer processingConfigurer) {
    TrackingEventProcessorConfiguration tepConfig = 
        TrackingEventProcessorConfiguration.forSingleThreadedProcessing();
    processingConfigurer.registerTrackingEventProcessorConfiguration(
        "myTrackingProcessorGroup", 
        config -> tepConfig
    );
}
         
    
@Autowired
public void configure(EventProcessingConfigurer config) {
    config.usingSubscribingEventProcessors();
}
     

【问题讨论】:

    标签: spring-boot axon


    【解决方案1】:

    您分享的这段代码没有任何问题。

    看看EventProcessingConfigurerAPI,你有:

    • registerTrackingEventProcessor
    • registerSubscribingEventProcessor
    • registerPooledStreamingEventProcessor

    他们都将使用给定的类型注册一个EventProcessor,您可以在ref guide 上阅读有关这些的更多信息。

    另一种方法是使用propertiesyml 文件,如下所示:

    axon.eventhandling.processors.my-subscribing-processor.mode=subscribing
    axon.eventhandling.processors.my-tracking-processor.mode=tracking
    axon.eventhandling.processors.my-pooled-processor.mode=pooled
    

    对于您共享的最后一个配置 (config.usingSubscribingEventProcessors();),这是默认类型,以防您未使用显式类型注册 EventHandler

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-03-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多