public class AnnotationQueryHandlerAdapter<T> extends Object implements QueryHandlerAdapter, MessageHandler<QueryMessage<?,?>>
@QueryHandler
annotated bean into a MessageHandler
implementation. Each annotated method is subscribed
as a QueryHandler at the QueryBus
for the query type specified by the parameter/return type of that method.Constructor and Description |
---|
AnnotationQueryHandlerAdapter(T target)
Initializes the adapter, forwarding call to the given
target . |
AnnotationQueryHandlerAdapter(T target,
ParameterResolverFactory parameterResolverFactory)
Initializes the adapter, forwarding call to the given
target , resolving parameters using the given
parameterResolverFactory . |
AnnotationQueryHandlerAdapter(T target,
ParameterResolverFactory parameterResolverFactory,
HandlerDefinition handlerDefinition)
Initializes the adapter, forwarding call to the given
target , resolving parameters using the given
parameterResolverFactory and creating handlers using handlerDefinition . |
Modifier and Type | Method and Description |
---|---|
Object |
handle(QueryMessage<?,?> message)
Handles the given
message . |
Registration |
subscribe(QueryBus queryBus)
Subscribes query handlers to the given query bus
|
public AnnotationQueryHandlerAdapter(T target)
target
.target
- The instance with QueryHandler
annotated methodspublic AnnotationQueryHandlerAdapter(T target, ParameterResolverFactory parameterResolverFactory)
target
, resolving parameters using the given
parameterResolverFactory
.target
- The instance with QueryHandler
annotated methodsparameterResolverFactory
- The parameter resolver factory to resolve handler parameters withpublic AnnotationQueryHandlerAdapter(T target, ParameterResolverFactory parameterResolverFactory, HandlerDefinition handlerDefinition)
target
, resolving parameters using the given
parameterResolverFactory
and creating handlers using handlerDefinition
.target
- The instance with QueryHandler
annotated methodsparameterResolverFactory
- The parameter resolver factory to resolve handler parameters withhandlerDefinition
- The handler definition used to create concrete handlerspublic Registration subscribe(QueryBus queryBus)
QueryHandlerAdapter
subscribe
in interface QueryHandlerAdapter
queryBus
- the query buspublic Object handle(QueryMessage<?,?> message) throws Exception
MessageHandler
message
.handle
in interface MessageHandler<QueryMessage<?,?>>
message
- The message to be processed.Exception
- any exception that occurs during message handlingCopyright © 2010–2018. All rights reserved.