Axon 4.0 Defining default tracking processor configuration

Hello

I have a quick question regarding Axon 4.0. What is the proper way to define things like SequencingPolicy, batchSize, threadCount and initialSegmentCount in the code. Everything in combination with spring.

Previously we were able to define the configuration for tracking processors using the EventHandlingConfiguration and/or EventProcessingConfiguration through @Autowired.

I try to achieve the same in Axon 4.0 and came up with following:

Configure default SequencingPolicy:

Variation 1
@Bean fun sequencingPolicy() = SequentialPolicy()

Variation 2
@Autowired fun configure(config: EventProcessingModule) { config.registerDefaultSequencingPolicy { SequentialPolicy() } }

Configure threadCount, segmentSize and batchSize

The only solution that somehow worked for me

@Autowired fun config(configurer: Configurer) { configurer.registerComponent(TrackingEventProcessorConfiguration::class.java, { TrackingEventProcessorConfiguration. .forParallelProcessing(2) .andInitialSegmentCount(4) }) }

Is this the right way to do it or am I missing something? I couldn’t find anything regarding Axon 4.0 in the documentation.

Kind regards
José

Hi José,

I can propose you a unified way of configuring these properties you want:

`
@Autowired
public void configure(Configurer configurer) {
configurer.eventProcessing(epc -> epc.registerDefaultSequencingPolicy(c -> new SequentialPolicy()))
.registerComponent(TrackingEventProcessorConfiguration.class,
c -> TrackingEventProcessorConfiguration.forParallelProcessing(2)
.andInitialSegmentsCount(4));
}

`


We might add an additional registerDefaultTrackingEventProcessorConfiguration method on EventProcessingConfigurer. We’ll for sure discuss it internally and keep you posted.

Hope this helps!

Cheers,
Milan

Hi Milan

Thanks a lot!

Hi

I’ve just created an issue to add a new method for the EventProcessingConfigurer.

Cheers,
Milan