I am using following method from Axon documentation, to intercept Events:
@Autowired
public void configureEventProcessing(Configurer configurer) {
configurer.eventProcessing().eventProcessingConfigurer.registerHandlerInterceptor(AssetStoreKafkaEventPublisher.DEFAULT_PROCESSING_GROUP,
configuration → new TelemetryEventHandlerInterceptor());
}
But its throwing exceptions in my unit test:
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type ‘org.axonframework.config.Configurer’ available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
I tried mocking it my unit test but not successful. Has anyone faced this issue? any workarounds?
Maybe try to put the EventProcessingConfigurer processingConfigurer as the argument you are autowiring instead of the Configurer? You can then configure it like you are doing anyway.
Or try to put the @Autowired block into a @TestConfiguration class which is loaded as part of the @SpringBootTest.
This solution isn’t working for me. @Autowired
public void configure(EventProcessingConfigurer configurer){
configurer.registerListenerInvocationErrorHandler(“sample”, config → new MyServiceEventsErrorHandler);
}
I am getting the same error, required a bean of type ‘org.axonframework.config.EventProcessingConfigurer’ that could not be found.