0
votes

I am trying to use Subscribing Event Processor and Tracking Event Processor in Axon config together without success. I am only able to use Subscribing Event Processor.

I am using Axon Framework 4.x version with Spring Boot

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

1 Answers

0
votes

There is nothing wrong with the piece of code you shared.

Looking at the EventProcessingConfigurer API, you have:

  • registerTrackingEventProcessor
  • registerSubscribingEventProcessor
  • registerPooledStreamingEventProcessor

All of them will register an EventProcessor with the given type and you can read more about those on the ref guide.

Another way to do that is to use a properties or yml file, like so:

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

For the last config you shared (config.usingSubscribingEventProcessors();), this is the default type in case you do not register an EventHandler with an explicit type.