@Override public EventProcessingConfiguration eventProcessingConfiguration() { return config.eventProcessingConfiguration(); }
private List<AbstractSagaManager> retrieveSagaManagers() { return configuration.eventProcessingConfiguration() .sagaConfigurations() .stream() .map(SagaConfiguration::manager) .collect(toList()); } }
@Override @Deprecated public <T extends EventProcessor> T eventProcessor() { ensureInitialized(); //noinspection unchecked return (T) config.eventProcessingConfiguration() .sagaEventProcessor(configurer.type) .orElseThrow(() -> new IllegalStateException(format( "Saga %s does not have a processor configured.", configurer.type))); }
@Override public String processingGroup() { ensureInitialized(); return config.eventProcessingConfiguration() .sagaProcessingGroup(configurer.type); }
@Override public ListenerInvocationErrorHandler listenerInvocationErrorHandler() { ensureInitialized(); return config.eventProcessingConfiguration() .listenerInvocationErrorHandler(processingGroup()); }
if (managerBuilder == null) { managerBuilder = c -> { EventProcessingConfiguration eventProcessingConfiguration = c.eventProcessingConfiguration(); return AnnotatedSagaManager.<S>builder() .sagaType(configurer.type)
private EventProcessingConfiguration eventProcessingConfiguration() { return config.eventProcessingConfiguration(); }
private List<AbstractSagaManager> retrieveSagaManagers() { return configuration.eventProcessingConfiguration() .sagaConfigurations() .stream() .map(SagaConfiguration::manager) .collect(toList()); } }
/** * Returns a list of Event Processors that have been initialized. Note that an empty list may be returned if this * configuration hasn't been {@link #initialize(Configuration) initialized} yet. * * @return a read-only list of processors initialized in this configuration. * @deprecated use {@link EventProcessingConfiguration#eventProcessors()} instead */ @Deprecated public List<EventProcessor> getProcessors() { Assert.state(config != null, () -> "Configuration is not initialized yet"); return new ArrayList<>(config.eventProcessingConfiguration().eventProcessors().values()); }
/** * Register a subscribing processor with given {@code name} that subscribes to the given {@code messageSource}. * This allows the use of standard Subscribing Processors that listen to another source than the Event Bus. * * @param name The name of the Event Processor * @param messageSource The source the processor should read from * @return this EventHandlingConfiguration instance for further configuration * @deprecated use {@link EventProcessingConfiguration#registerSubscribingEventProcessor(String, Function)} instead */ @SuppressWarnings("UnusedReturnValue") @Deprecated public EventHandlingConfiguration registerSubscribingEventProcessor( String name, Function<Configuration, SubscribableMessageSource<? extends EventMessage<?>>> messageSource) { onInit.add(conf -> conf.eventProcessingConfiguration() .registerSubscribingEventProcessor(name, messageSource)); return this; }
/** * Register the TokenStore to use for a processor of given {@code name}. * <p> * If no explicit TokenStore implementation is available for a Processor, it is taken from the main Configuration. * <p> * Note that this configuration is ignored if the processor with given name isn't a Tracking Processor. * * @param name The name of the processor to configure the token store for * @param tokenStore The function providing the TokenStore based on a given Configuration * @return this EventHandlingConfiguration instance for further configuration * @deprecated use {@link EventProcessingConfiguration#registerTokenStore(String, Function)} instead */ @Deprecated public EventHandlingConfiguration registerTokenStore(String name, Function<Configuration, TokenStore> tokenStore) { this.tokenStore.put(name, tokenStore); onInit.add(conf -> conf.eventProcessingConfiguration().registerTokenStore(name, tokenStore)); return this; }
/** * 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 factory to create the Message Monitor for the {@link EventProcessor} of the given name. This * overrides any Message Monitor configured through {@link Configurer}. * * @param name The name of the event processor * @param messageMonitorFactory The factory to use * @return this EventHandlingConfiguration instance for further configuration * @deprecated use {@link EventProcessingConfiguration#configureMessageMonitor(String, MessageMonitorFactory)} instead */ @Deprecated public EventHandlingConfiguration configureMessageMonitor(String name, MessageMonitorFactory messageMonitorFactory) { messageMonitorFactories.put(name, messageMonitorFactory); onInit.add(conf -> conf.eventProcessingConfiguration().configureMessageMonitor(name, messageMonitorFactory)); return this; }
@Override @Deprecated public <T extends EventProcessor> T eventProcessor() { ensureInitialized(); //noinspection unchecked return (T) config.eventProcessingConfiguration() .sagaEventProcessor(configurer.type) .orElseThrow(() -> new IllegalStateException(format( "Saga %s does not have a processor configured.", configurer.type))); }
/** * 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; }
/** * Returns the Event Processor with the given {@code name}, if present. This method also returns an unresolved * optional if the Processor was configured, but it hasn't been assigned any Event Handlers. * * @param name The name of the processor to return * @return an Optional referencing the processor, if present. * @deprecated use {@link EventProcessingConfiguration#eventProcessor(String)} instead */ @Deprecated public <T extends EventProcessor> Optional<T> getProcessor(String name) { Assert.state(config != null, () -> "Configuration is not initialized yet"); //noinspection unchecked return (Optional<T>) config.eventProcessingConfiguration().eventProcessor(name); }
@Override public String processingGroup() { ensureInitialized(); return config.eventProcessingConfiguration() .sagaProcessingGroup(configurer.type); }
/** * Returns the Event Processor with the given {@code name}, if present and of the given {@code expectedType}. This * method also returns an empty optional if the Processor was configured, but it hasn't been assigned any Event * Handlers. * * @param name The name of the processor to return * @param expectedType The type of processor expected * @param <T> The type of processor expected * @return an Optional referencing the processor, if present and of expected type. * @deprecated use {@link EventProcessingConfiguration#eventProcessor(String, Class)} instead */ @Deprecated public <T extends EventProcessor> Optional<T> getProcessor(String name, Class<T> expectedType) { Assert.state(config != null, () -> "Configuration is not initialized yet"); return config.eventProcessingConfiguration().eventProcessor(name, expectedType); }
/** * Allows for more fine-grained definition of the Event Processor to use for each group of Event Listeners. The * given builder is expected to create a fully initialized Event Processor implementation based on the name and * list of event handler beans. The builder also received the global configuration instance, from which it can * retrieve components. * <p> * Note that the processor must be initialized, but shouldn't be started yet. The processor's * {@link EventProcessor#start()} method is invoked when the global configuration is started. * * @param eventProcessorBuilder The builder function for the Event Processor * @return this EventHandlingConfiguration instance for further configuration * @deprecated use {@link EventProcessingConfiguration#registerEventProcessorFactory(EventProcessingConfiguration.EventProcessorBuilder)} * instead */ @Deprecated public EventHandlingConfiguration registerEventProcessorFactory(EventProcessorBuilder eventProcessorBuilder) { onInit.add(conf -> conf.eventProcessingConfiguration() .registerEventProcessorFactory( (name, config, eventHandlerInvoker) -> buildEventProcessor(name, config, (MultiEventHandlerInvoker) eventHandlerInvoker, eventProcessorBuilder))); return this; }
@Override public ListenerInvocationErrorHandler listenerInvocationErrorHandler() { ensureInitialized(); return config.eventProcessingConfiguration() .listenerInvocationErrorHandler(processingGroup()); }