/** * Configures a {@link org.axonframework.eventhandling.ErrorHandler} for the * {@link org.axonframework.eventhandling.EventProcessor} of the given {@code name}. This * overrides the default ErrorHandler configured through the {@link org.axonframework.config.Configurer}. * * @param name The name of the event processor * @param errorHandlerBuilder The {@link org.axonframework.eventhandling.ErrorHandler} to use for the * {@link org.axonframework.eventhandling.EventProcessor} with the given {@code name} * @return this {@link EventHandlingConfiguration} instance for further configuration * @deprecated use {@link EventProcessingConfiguration#configureErrorHandler(String, Function)} instead */ @Deprecated public EventHandlingConfiguration configureErrorHandler(String name, Function<Configuration, ErrorHandler> errorHandlerBuilder) { errorHandlers.put(name, errorHandlerBuilder); onInit.add(conf -> conf.eventProcessingConfiguration().configureErrorHandler(name, errorHandlerBuilder)); return this; }
/** * Configures the default {@link org.axonframework.eventhandling.ErrorHandler} for any * {@link org.axonframework.eventhandling.EventProcessor}. This can be overridden per EventProcessor by calling the * {@link EventHandlingConfiguration#configureErrorHandler(String, Function)} function. * * @param errorHandlerBuilder The {@link org.axonframework.eventhandling.ErrorHandler} to use for the * {@link org.axonframework.eventhandling.EventProcessor} with the given {@code name} * @return this {@link EventHandlingConfiguration} instance for further configuration * @deprecated use {@link EventProcessingConfiguration#configureErrorHandler(Function)} instead */ @Deprecated public EventHandlingConfiguration configureErrorHandler(Function<Configuration, ErrorHandler> errorHandlerBuilder) { defaultErrorHandler.update(errorHandlerBuilder); onInit.add(conf -> conf.eventProcessingConfiguration().configureErrorHandler(errorHandlerBuilder)); return this; }
@Override public void initialize(Configuration config) { this.config = config; eventProcessingConfiguration().registerHandlerInvoker(processorInfo.getProcessingGroup(), c -> sagaManager.get()); eventProcessingConfiguration().registerTokenStore(processorInfo.getProcessingGroup(), c -> tokenStore.get()); eventProcessingConfiguration().configureMessageMonitor(processorInfo.getProcessingGroup(), c -> (MessageMonitor<Message<?>>) messageMonitor.get()); eventProcessingConfiguration().configureErrorHandler(processorInfo.getProcessingGroup(), c -> errorHandler.get()); eventProcessingConfiguration().configureRollbackConfiguration(processorInfo.getProcessingGroup(), c -> rollbackConfiguration.get()); eventProcessingConfiguration().configureTransactionManager(processorInfo.getProcessingGroup(), c -> transactionManager.get()); handlerInterceptors.forEach(i -> eventProcessingConfiguration() .registerHandlerInterceptor(processorInfo.getProcessingGroup(), i)); if (processorInfo.isCreateNewProcessor()) { switch (processorInfo.getType()) { case TRACKING: eventProcessingConfiguration().registerEventProcessor(processorInfo.getProcessingGroup(), this::buildTrackingEventProcessor); break; case SUBSCRIBING: eventProcessingConfiguration().registerEventProcessor(processorInfo.getProcessingGroup(), this::buildSubscribingEventProcessor); break; default: throw new IllegalStateException("Unsupported event processor type."); } } }