Interface QueryBusConnector
- All Superinterfaces:
DescribableComponent
- All Known Implementing Classes:
AxonServerQueryBusConnector,DelegatingQueryBusConnector,PayloadConvertingQueryBusConnector
The
QueryBusConnector interface defines the contract for connecting multiple
QueryBus instances.
It allows for the dispatching of queries across different query bus instances, whether they are local or remote. One
connector can be wrapped with another through the DelegatingQueryBusConnector, upon which more functionality
can be added, such as payload conversion or conversion.
- Since:
- 5.0.0
- Author:
- Steven van Beelen
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceDefines a handler for processing query messages and managing subscription queries.static interfaceDefines a callback mechanism to handle update messages for subscription queries in a reactive and asynchronous manner. -
Method Summary
Modifier and TypeMethodDescriptionvoidonIncomingQuery(QueryBusConnector.Handler handler) Registers a handler to process incoming query messages.query(QueryMessage query, ProcessingContext context) Sends the givenqueryto the remote QueryBus.subscribe(QualifiedName name) Subscribes this connector to queries matching the givenname.subscriptionQuery(QueryMessage query, ProcessingContext context, int updateBufferSize) Sends the givenqueryto the remote QueryBus.booleanunsubscribe(QualifiedName name) Unsubscribes this connector from queries with the givenname.Methods inherited from interface org.axonframework.common.infra.DescribableComponent
describeTo
-
Method Details
-
query
@Nonnull MessageStream<QueryResponseMessage> query(@Nonnull QueryMessage query, @Nullable ProcessingContext context) Sends the givenqueryto the remote QueryBus.- Parameters:
query- The query to send to the remote QueryBus.context- The context, if available, in which the query is generated- Returns:
- the stream of responses for the query
- See Also:
-
subscriptionQuery
@Nonnull MessageStream<QueryResponseMessage> subscriptionQuery(@Nonnull QueryMessage query, @Nullable ProcessingContext context, int updateBufferSize) Sends the givenqueryto the remote QueryBus.- Parameters:
query- The query to send to the remote QueryBus.context- The context, if available, in which the query is generatedupdateBufferSize- The size of the buffer used to store update for the subscription query.- Returns:
- the stream of responses for the query
- See Also:
-
subscribe
Subscribes this connector to queries matching the givenname.- Parameters:
name- TheQualifiedNameof theMessage.type()to subscribe to.- Returns:
- A
CompletableFuturethat completes successfully when this connector subscribed to the givenname.
-
unsubscribe
Unsubscribes this connector from queries with the givenname.- Parameters:
name- TheQualifiedNameof theMessage.type()to unsubscribe from.- Returns:
trueif unsubscribing was successful,falseotherwise.
-
onIncomingQuery
Registers a handler to process incoming query messages.- Parameters:
handler- The handler responsible for managing incoming queries.
-