@Override public QueryBus queryBus() { return config.queryBus(); }
@NoBeanOfType(QueryBus.class) @Bean("queryBus") public QueryBus defaultQueryBus() { return config.queryBus(); }
/** * Returns a {@link DefaultQueryGateway} that will use the configuration's {@link QueryBus} to dispatch queries. * * @param config The configuration that supplies the query bus. * @return The default query gateway. */ protected QueryGateway defaultQueryGateway(Configuration config) { return DefaultQueryGateway.builder().queryBus(config.queryBus()).build(); }
@Override @SuppressWarnings("unchecked") public Configurer registerQueryHandler(int phase, Function<Configuration, Object> annotatedQueryHandlerBuilder) { startHandlers.add(new RunnableHandler(phase, () -> { Object annotatedHandler = annotatedQueryHandlerBuilder.apply(config); Assert.notNull(annotatedHandler, () -> "annotatedQueryHandler may not be null"); Registration registration = new AnnotationQueryHandlerAdapter(annotatedHandler, config.parameterResolverFactory(), config.handlerDefinition(annotatedHandler .getClass())) .subscribe(config.queryBus()); shutdownHandlers.add(new RunnableHandler(phase, registration::cancel)); })); return this; }
/** * Returns a {@link DefaultQueryGateway} that will use the configuration's {@link QueryBus} to dispatch queries. * * @param config The configuration that supplies the query bus. * @return The default query gateway. */ protected QueryGateway defaultQueryGateway(Configuration config) { return new DefaultQueryGateway(config.queryBus()); }
/** * Returns a {@link DefaultQueryGateway} that will use the configuration's {@link QueryBus} to dispatch queries. * * @param config The configuration that supplies the query bus. * @return The default query gateway. */ protected QueryGateway defaultQueryGateway(Configuration config) { return DefaultQueryGateway.builder().queryBus(config.queryBus()).build(); }
@Override @SuppressWarnings("unchecked") public Configurer registerQueryHandler(int phase, Function<Configuration, Object> annotatedQueryHandlerBuilder) { startHandlers.add(new RunnableHandler(phase, () -> { Object annotatedHandler = annotatedQueryHandlerBuilder.apply(config); Assert.notNull(annotatedHandler, () -> "annotatedQueryHandler may not be null"); Registration registration = new AnnotationQueryHandlerAdapter(annotatedHandler, config.parameterResolverFactory(), config.handlerDefinition(annotatedHandler .getClass())) .subscribe(config.queryBus()); shutdownHandlers.add(new RunnableHandler(phase, registration::cancel)); })); return this; }
@Override @SuppressWarnings("unchecked") public Configurer registerQueryHandler(int phase, Function<Configuration, Object> annotatedQueryHandlerBuilder) { startHandlers.add(new RunnableHandler(phase, () -> { Object annotatedHandler = annotatedQueryHandlerBuilder.apply(config); Assert.notNull(annotatedHandler, () -> "annotatedQueryHandler may not be null"); Registration registration = new AnnotationQueryHandlerAdapter(annotatedHandler, config.parameterResolverFactory(), config.handlerDefinition(annotatedHandler .getClass())) .subscribe(config.queryBus()); shutdownHandlers.add(new RunnableHandler(phase, registration::cancel)); })); return this; }