axon controller 不能获取 event里面自定义 exception 的解决方式

配置:

@Configuration
public class MyAxonConfiguration extends EventHandlingConfiguration{

@Bean
public EventHandlingConfiguration eventHandlingConfiguration(EventHandlingConfiguration config) {
config.configureListenerInvocationErrorHandler(c -> c.getComponent(ListenerInvocationErrorHandler.class, MyErrorHandlerImpl::new));
return config;
}
}@Component
public class MyErrorHandlerImpl implements ListenerInvocationErrorHandler{

private static final Logger LOGGER = getLogger(MyErrorHandlerImpl.class);

@Override
public void onError(Exception exception, EventMessage<?> event, EventListener eventListener) throws Exception {
LOGGER.info("☋☋☋☋☋☋☋☋☋☋☋☋ Start MyErrorHandlerImpl ☋☋☋☋☋☋☋☋☋☋☋☋");

throw exception;
}
}
原文地址:https://www.cnblogs.com/lshan/p/11313183.html