Interface QueryHandler
-
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface QueryHandler
Interface representing a component that can handle queries.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceQueryHandler.UpdateHandlerInterface describing a stream of updates to a subscription query.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description voidhandle(QueryRequest query, ReplyChannel<QueryResponse> responseHandler)Handle the givenquery, using givenresponseHandlerto send the response(s).default RegistrationregisterSubscriptionQuery(SubscriptionQuery query, QueryHandler.UpdateHandler updateHandler)Registers an incoming subscription query request, represented by givenquery, using givenupdateHandlerto send updates when the projection for this query changes.default FlowControlstream(QueryRequest query, ReplyChannel<QueryResponse> responseHandler)Handle the givenquery, using the givenresponseHandlerto send the response(s).
-
-
-
Method Detail
-
handle
void handle(QueryRequest query, ReplyChannel<QueryResponse> responseHandler)
Handle the givenquery, using givenresponseHandlerto send the response(s).Note that the query must be completed using
ReplyChannel.complete()orReplyChannel.sendLast(Object).- Parameters:
query- the message representing the query requestresponseHandler- to handler to send responses with
-
stream
default FlowControl stream(QueryRequest query, ReplyChannel<QueryResponse> responseHandler)
Handle the givenquery, using the givenresponseHandlerto send the response(s). This operation is flow control aware, hence messages should be sent viaresponseHandlerwhen requested.Note that the query must be completed using
ReplyChannel.complete()orReplyChannel.sendLast(Object).- Parameters:
query- the message representing the query requestresponseHandler- the handler to send responses with- Returns:
- a
FlowControlto request more responses and cancel sending responses
-
registerSubscriptionQuery
default Registration registerSubscriptionQuery(SubscriptionQuery query, QueryHandler.UpdateHandler updateHandler)
Registers an incoming subscription query request, represented by givenquery, using givenupdateHandlerto send updates when the projection for this query changes.If this handler doesn't support subscription queries for the given
query, it should returnnull. Otherwise, it must return a handle that can be used to cancel the subscription query.- Parameters:
query- the message representing the queryupdateHandler- to handler to send updates with- Returns:
- a registration to cancel the subscription, or
nullif this handler doesn't support the subscription query
-
-