Interface QueryChannel
-
- All Known Implementing Classes:
QueryChannelImpl
public interface QueryChannelCommunication channel with AxonServer for Query related interactions.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description CompletableFuture<Void>prepareDisconnect()Prepares thisQueryChannelto disconnect, by unsubscribing all registered query handlers.ResultStream<QueryResponse>query(QueryRequest query)Sends the givenqueryto AxonServer for routing to the appropriate handlers.RegistrationregisterQueryHandler(QueryHandler handler, QueryDefinition... queryTypes)Registers the givenhandlerto handle incoming queries defined through the givenqueryTypes.SubscriptionQueryResultsubscriptionQuery(QueryRequest query, int bufferSize, int fetchSize)Sends out a subscriptionqueryto AxonServer for routing to the appropriate handler.default SubscriptionQueryResultsubscriptionQuery(QueryRequest query, SerializedObject updateType, int bufferSize, int fetchSize)Deprecated.in favor ofsubscriptionQuery(QueryRequest, int, int).
-
-
-
Method Detail
-
registerQueryHandler
Registration registerQueryHandler(QueryHandler handler, QueryDefinition... queryTypes)
Registers the givenhandlerto handle incoming queries defined through the givenqueryTypes. Duplicatehandlers can be registered.- Parameters:
handler- the handler to handle incoming queries withqueryTypes- theQueryDefinitions to register the handler for- Returns:
- a registration which allows the query handler to be deregistered
-
query
ResultStream<QueryResponse> query(QueryRequest query)
Sends the givenqueryto AxonServer for routing to the appropriate handlers.- Parameters:
query- theQueryRequestto send- Returns:
- a
ResultStreamproviding the results of query execution
-
subscriptionQuery
SubscriptionQueryResult subscriptionQuery(QueryRequest query, int bufferSize, int fetchSize)
Sends out a subscriptionqueryto AxonServer for routing to the appropriate handler. Allows for receiving an initial query result followed by a stream of updates.- Parameters:
query- the subscriptionQueryRequestto sendbufferSize- the number of updates to be buffered by the update result streamfetchSize- the number of updates to be consumed from the update stream prior to refilling it- Returns:
- the
SubscriptionQueryResultcontaining the initial result and update stream
-
subscriptionQuery
@Deprecated(since="2025.2.0") default SubscriptionQueryResult subscriptionQuery(QueryRequest query, SerializedObject updateType, int bufferSize, int fetchSize)
Deprecated.in favor ofsubscriptionQuery(QueryRequest, int, int). UpdateType is not used.Sends out a subscriptionqueryto AxonServer for routing to the appropriate handler. Allows for receiving an initial query result followed by a stream of updates.- Parameters:
query- the subscriptionQueryRequestto sendupdateType- the type of updates expected from this subscription querybufferSize- the number of updates to be buffered by the update result streamfetchSize- the number of updates to be consumed from the update stream prior to refilling it- Returns:
- the
SubscriptionQueryResultcontaining the initial result and update stream
-
prepareDisconnect
CompletableFuture<Void> prepareDisconnect()
Prepares thisQueryChannelto disconnect, by unsubscribing all registered query handlers. Will wait with a certain cut off until all acknowledgments of unsubscribing have been received.This method should be used if a connected client wants to disconnect from AxonServer.
- Returns:
- a
CompletableFutureofVoidto react when all query handlers have been unsubscribed
-
-