/** * Locates the {@link EventProcessingConfigurer} registered as a module with this Configurer and provides it to the * given consumer for configuration. If there aren't any pre-registered instances of * {@link EventProcessingConfigurer}, it will create an {@link EventProcessingModule} and register it as a module. * If there are multiple, an {@link AxonConfigurationException} is thrown. * * This method is identical to using {@link #eventProcessing()}, except that this variant allows for easier fluent * interfacing. * * @param eventProcessingConfigurer a consumer to configure the * @return an instance of Event Processing Configurer * * @throws AxonConfigurationException thrown if there are multiple {@link EventProcessingConfigurer}s */ default Configurer eventProcessing(Consumer<EventProcessingConfigurer> eventProcessingConfigurer) throws AxonConfigurationException { eventProcessingConfigurer.accept(eventProcessing()); return this; }
/** * Registers a {@link Function} that builds an Event Handler instance. * * @param eventHandlerBuilder a {@link Function} that builds an Event Handler instance. * @return the current instance of the Configurer, for chaining purposes. */ default Configurer registerEventHandler(Function<Configuration, Object> eventHandlerBuilder) { eventProcessing().registerEventHandler(eventHandlerBuilder); return this; }
.addConstructorArgReference(AXON_CONFIGURER_BEAN).getBeanDefinition()); try { EventProcessingConfigurer eventProcessingConfigurer = configurer.eventProcessing(); registerSagaBeanDefinitions(eventProcessingConfigurer); registerEventHandlerRegistrar(eventProcessingConfigurationName,
@Before public void setUp() { EventStore eventStore = spy(EmbeddedEventStore.builder() .storageEngine(new InMemoryEventStorageEngine()) .build()); Configurer configurer = DefaultConfigurer.defaultConfiguration(); configurer.eventProcessing() .usingSubscribingEventProcessors() .registerSaga(MySaga.class); configuration = configurer.configureEventStore(c -> eventStore) .configureAggregate(MyAggregate.class) .registerComponent(DeadlineManager.class, this::buildDeadlineManager) .start(); published = new CopyOnWriteArrayList<>(); configuration.eventBus().subscribe(msgs -> msgs.forEach(msg -> published.add(msg.getPayload()))); }
@Test public void testQueryHandlerAndEventHandlerCleanlyShutdown() { UserSummaryProjection userSummaryProjection = new UserSummaryProjection(); Configurer configurer = DefaultConfigurer.defaultConfiguration(); configurer.configureCommandBus(c -> SimpleCommandBus.builder().build()) .configureQueryBus(c -> SimpleQueryBus.builder().build()) .configureEmbeddedEventStore(c -> new InMemoryEventStorageEngine()) .registerQueryHandler(c -> userSummaryProjection); configurer.eventProcessing() .registerEventHandler(c -> userSummaryProjection); Configuration configuration = configurer.buildConfiguration(); configuration.start(); configuration.shutdown(); }
/** * Locates the {@link EventProcessingConfigurer} registered as a module with this Configurer and provides it to the * given consumer for configuration. If there aren't any pre-registered instances of * {@link EventProcessingConfigurer}, it will create an {@link EventProcessingModule} and register it as a module. * If there are multiple, an {@link AxonConfigurationException} is thrown. * * This method is identical to using {@link #eventProcessing()}, except that this variant allows for easier fluent * interfacing. * * @param eventProcessingConfigurer a consumer to configure the * @return an instance of Event Processing Configurer * * @throws AxonConfigurationException thrown if there are multiple {@link EventProcessingConfigurer}s */ default Configurer eventProcessing(Consumer<EventProcessingConfigurer> eventProcessingConfigurer) throws AxonConfigurationException { eventProcessingConfigurer.accept(eventProcessing()); return this; }