public class QueryChannelImpl extends AbstractAxonServerChannel<QueryProviderOutbound> implements QueryChannel
QueryChannel implementation, serving as the query connection between AxonServer and a client application.| Constructor and Description |
|---|
QueryChannelImpl(ClientIdentification clientIdentification,
String context,
int permits,
int permitsBatch,
ScheduledExecutorService executor,
AxonServerManagedChannel channel)
Constructs a
QueryChannelImpl. |
| Modifier and Type | Method and Description |
|---|---|
void |
connect()
Connect this channel with AxonServer.
|
void |
disconnect()
Disconnect this channel from AxonServer.
|
boolean |
isReady()
Validate whether this channel has all required streams connected with AxonServer.
|
CompletableFuture<Void> |
prepareDisconnect()
Prepares this
QueryChannel to disconnect, by unsubscribing all registered query handlers. |
ResultStream<QueryResponse> |
query(QueryRequest query)
Sends the given
query to AxonServer for routing to the appropriate handlers. |
void |
reconnect()
Reconnect this channel with AxonServer.
|
Registration |
registerQueryHandler(QueryHandler handler,
QueryDefinition... queryDefinitions)
Registers the given
handler to handle incoming queries defined through the given queryTypes. |
SubscriptionQueryResult |
subscriptionQuery(QueryRequest query,
SerializedObject updateResponseType,
int bufferSize,
int fetchSize)
Sends out a subscription
query to AxonServer for routing to the appropriate handler. |
processAck, scheduleImmediateReconnect, scheduleReconnect, sendInstructionpublic QueryChannelImpl(ClientIdentification clientIdentification, String context, int permits, int permitsBatch, ScheduledExecutorService executor, AxonServerManagedChannel channel)
QueryChannelImpl.clientIdentification - client information identifying whom has connected. This information is used to pass
on to messagepermits - an int defining the number of permits this channel haspermitsBatch - an int defining the number of permits to be consumed from prior to requesting
additional permits for this channelexecutor - a ScheduledExecutorService used to schedule reconnects of this channelchannel - the AxonServerManagedChannel used to form the connection with AxonServerpublic void connect()
AbstractAxonServerChannelconnect in class AbstractAxonServerChannel<QueryProviderOutbound>public Registration registerQueryHandler(QueryHandler handler, QueryDefinition... queryDefinitions)
QueryChannelhandler to handle incoming queries defined through the given queryTypes.
Duplicate handlers can be registered.registerQueryHandler in interface QueryChannelhandler - the handler to handle incoming queries withqueryDefinitions - the QueryDefinitions to register the handler forpublic ResultStream<QueryResponse> query(QueryRequest query)
QueryChannelquery to AxonServer for routing to the appropriate handlers.query in interface QueryChannelquery - the QueryRequest to sendResultStream providing the results of query executionpublic SubscriptionQueryResult subscriptionQuery(QueryRequest query, SerializedObject updateResponseType, int bufferSize, int fetchSize)
QueryChannelquery to AxonServer for routing to the appropriate handler. Allows for receiving
an initial query result followed by a stream of updates.subscriptionQuery in interface QueryChannelquery - the subscription QueryRequest to sendupdateResponseType - 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 itSubscriptionQueryResult containing the initial result and update streampublic void disconnect()
AbstractAxonServerChanneldisconnect in class AbstractAxonServerChannel<QueryProviderOutbound>public void reconnect()
AbstractAxonServerChannelreconnect in class AbstractAxonServerChannel<QueryProviderOutbound>public CompletableFuture<Void> prepareDisconnect()
QueryChannelQueryChannel to 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.
prepareDisconnect in interface QueryChannelCompletableFuture of Void to react when all query handlers have been unsubscribedpublic boolean isReady()
AbstractAxonServerChanneltrue.isReady in class AbstractAxonServerChannel<QueryProviderOutbound>true if this channel is connected with AxonServer or does not require any active connections,
false otherwiseCopyright © 2020–2023 AxonIQ BV. All rights reserved.