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. |
| 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 Registration subscribe(QueryBus queryBus)
QueryHandlerAdaptersubscribe in interface QueryHandlerAdapterqueryBus - the query buspublic Object handle(QueryMessage<?,?> message) throws Exception
MessageHandlermessage.handle in interface MessageHandler<QueryMessage<?,?>>message - The message to be processed.Exception - any exception that occurs during message handlingCopyright © 2010–2017. All rights reserved.