Interface QueryHandlingModule.QueryHandlerPhase
- All Superinterfaces:
ModuleBuilder<QueryHandlingModule>
- Enclosing interface:
QueryHandlingModule
Every registered QueryHandler will be subscribed with the QueryBus of the
ApplicationConfigurer this module is given to.
Provides roughly two options for configuring query handlers. Firstly, a query handler can be registered as is,
through the queryHandler(QualifiedName, QueryHandler) method. Secondly, if the query handler provides
components from the Configuration, a builder of the query handler can be
registered through the queryHandler(QualifiedName, ComponentBuilder) method.
-
Method Summary
Modifier and TypeMethodDescriptionannotatedQueryHandlingComponent(ComponentBuilder<Object> handlingComponentBuilder) Registers the givenhandlingComponentBuilderas anAnnotatedQueryHandlingComponentwithin this module.queryHandler(QualifiedName queryName, ComponentBuilder<QueryHandler> queryHandlerBuilder) Registers the givenqueryHandlerBuilderfor the given qualifiedqueryNamewithin this module.queryHandler(QualifiedName queryName, QueryHandler queryHandler) Registers the givenqueryHandlerfor the given qualifiedqueryNameandresponseNamewithin this module.queryHandlingComponent(ComponentBuilder<QueryHandlingComponent> handlingComponentBuilder) Registers the givenhandlingComponentBuilderwithin this module.Methods inherited from interface org.axonframework.common.configuration.ModuleBuilder
build
-
Method Details
-
queryHandler
default QueryHandlingModule.QueryHandlerPhase queryHandler(@Nonnull QualifiedName queryName, @Nonnull QueryHandler queryHandler) Registers the givenqueryHandlerfor the given qualifiedqueryNameandresponseNamewithin this module.Use this query handler registration method when the query handler in question does not require entities or receives entities through another mechanism. Using a
MessageTypeResolverto derive thequeryNameis beneficial to ensure consistent naming across handler subscriptions.Once this module is finalized, the query handler will be subscribed with the
QueryBusof theApplicationConfigurerthe module is registered on.- Parameters:
queryName- The qualified name of the query the givenqueryHandlercan handle.queryHandler- The query handler to register with this module.- Returns:
- The query handler phase of this builder, for a fluent API.
-
queryHandler
QueryHandlingModule.QueryHandlerPhase queryHandler(@Nonnull QualifiedName queryName, @Nonnull ComponentBuilder<QueryHandler> queryHandlerBuilder) Registers the givenqueryHandlerBuilderfor the given qualifiedqueryNamewithin this module.Using a
MessageTypeResolverto derive thequeryNameis beneficial to ensure consistent naming across handler subscriptions.Once this module is finalized, the query handler from the
queryHandlerBuilderwill be subscribed with theQueryBusof theApplicationConfigurerthe module is registered on.- Parameters:
queryName- The qualified name of the query theQueryHandlercreated by the givenqueryHandlerBuilder.queryHandlerBuilder- A builder of aQueryHandler. Provides theConfigurationto retrieve components from to use during construction of the query handler.- Returns:
- The query handler phase of this builder, for a fluent API.
-
queryHandlingComponent
QueryHandlingModule.QueryHandlerPhase queryHandlingComponent(@Nonnull ComponentBuilder<QueryHandlingComponent> handlingComponentBuilder) Registers the givenhandlingComponentBuilderwithin this module.Use this query handler registration method when the query handling component in question does not require entities or receives entities through another mechanism.
Once this module is finalized, the resulting
QueryHandlingComponentfrom thehandlingComponentBuilderwill be subscribed with theQueryBusof theApplicationConfigurerthe module is registered on.- Parameters:
handlingComponentBuilder- A builder of aQueryHandlingComponent. Provides theConfigurationto retrieve components from to use during construction of the query handling component.- Returns:
- The query handler phase of this builder, for a fluent API.
-
annotatedQueryHandlingComponent
default QueryHandlingModule.QueryHandlerPhase annotatedQueryHandlingComponent(@Nonnull ComponentBuilder<Object> handlingComponentBuilder) Registers the givenhandlingComponentBuilderas anAnnotatedQueryHandlingComponentwithin this module.This will scan the given
handlingComponentBuilderfor methods annotated withQueryHandlerand register them as query handlers for theQueryBusof theApplicationConfigurer.- Parameters:
handlingComponentBuilder- A builder of aQueryHandlingComponent. Provides theConfigurationto retrieve components from to use during construction of the query handling component.- Returns:
- The query handler phase of this builder, for a fluent API.
-