/** * Registers a query handler bean with this configuration. The bean may be of any type. The actual query handler * methods will be detected based on the annotations present on the bean's methods. * <p> * The builder function receives the Configuration as input, and is expected to return a fully initialized instance * of the query handler bean. * * @param annotatedQueryHandlerBuilder The builder function of the Query Handler bean * @return the current instance of the Configurer, for chaining purposes */ default Configurer registerQueryHandler(Function<Configuration, Object> annotatedQueryHandlerBuilder) { return registerQueryHandler(0, annotatedQueryHandlerBuilder); }
@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(); }
/** * Registers a query handler bean with this configuration. The bean may be of any type. The actual query handler * methods will be detected based on the annotations present on the bean's methods. * <p> * The builder function receives the Configuration as input, and is expected to return a fully initialized instance * of the query handler bean. * * @param annotatedQueryHandlerBuilder The builder function of the Query Handler bean * @return the current instance of the Configurer, for chaining purposes */ default Configurer registerQueryHandler(Function<Configuration, Object> annotatedQueryHandlerBuilder) { return registerQueryHandler(0, annotatedQueryHandlerBuilder); }
/** * Registers a query handler bean with this configuration. The bean may be of any type. The actual query handler * methods will be detected based on the annotations present on the bean's methods. * <p> * The builder function receives the Configuration as input, and is expected to return a fully initialized instance * of the query handler bean. * * @param annotatedQueryHandlerBuilder The builder function of the Query Handler bean * @return the current instance of the Configurer, for chaining purposes */ default Configurer registerQueryHandler(Function<Configuration, Object> annotatedQueryHandlerBuilder) { return registerQueryHandler(0, annotatedQueryHandlerBuilder); }