[Axon 3.3] Changes in Multithreading behaviour of EventHandlers from 3.2 to 3.3

Hi,

wie are trying to migrate from Axon 2.2.x to 3.3.5. Now we have several test failures stating that some events are not availiable in the event store. These tests are flickering: Sometimes they pass.

We found out that event handling for EventHandlers and Sagas suddenly is asynchronous. The command is triggered in the “main”-thread and the corresponding event is also thrown in “main”-thread. But the event handler (saga or standalone) are working in threads “pool-{x}-thread-1” and the events that happen after the event handling are processed in this thread. The test framework proceeds in the main-thread and the events could have been thown - or not.

In Axon 2.2 the whole handling was on the main tread. This seems to be a breaking change in 3.3.

The Sagas are registered by

configurer.registerModule(SagaConfiguration.subscribingSagaManager(MySaga.class))

and the event handler are configured by

EventHandlingConfiguration eventHandlingConfiguration = new EventHandlingConfiguration()
        .registerEventHandler(c -> myEventHandler1)
        .registerEventHandler(c -> myEventHandler2)

configurer.registerModule(eventHandlingConfiguration)

How can we change the configuration to get the old behaviour? 

And/or: what is the best strategy for integration tests that send an command and check the resulting events 
(with several sagas and aggregates in place in one command execution)? (Wait() is not an option...)

Regards
Marc

Hi,

this is a change in the default behaviour of axon configuration: The default in Axon 2.2.x is a SubcribingEventProcessor. In Axon 3.3.x the default is a TrackingEventProcessor.

We changed the configuration to

EventHandlingConfiguration eventHandlingConfiguration = new EventHandlingConfiguration()
        .registerSubscribingEventProcessor(EVENT_HANDLER_PROCESSOR)
        .byDefaultAssignTo(EVENT_HANDLER_PROCESSOR)
        .registerEventHandler(...)

and this fixed the problem.

Imho this is a breaking change between Axon 2.2. and Axon 3.3 and at least should be documented in the release notes… I have created an issue for this (https://github.com/AxonFramework/AxonFramework/issues/731).

Regards
Marc

Hi Marc,

we are not aware of any changes in the default settings. In Axon 3.3, the default is still a subscribing processor.
Can you share the configuration that gives you a TrackingProcessor instead of a Subscribing one?

Cheers,

Allard