Interface QueryBusConnector

All Superinterfaces:
DescribableComponent
All Known Implementing Classes:
AxonServerQueryBusConnector, DelegatingQueryBusConnector, MultiTenantAxonServerQueryBusConnector, PayloadConvertingQueryBusConnector, TracingQueryBusConnector

public interface QueryBusConnector extends DescribableComponent
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
  • Method Details

    • query

      Sends the given query to 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

      MessageStream<QueryResponseMessage> subscriptionQuery(QueryMessage query, @Nullable ProcessingContext context, int updateBufferSize)
      Sends the given query to the remote QueryBus.
      Parameters:
      query - The query to send to the remote QueryBus.
      context - The context, if available, in which the query is generated
      updateBufferSize - 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 given name.

      A connector serves queries of a given name with a single handler. Subscribing a name this connector is already subscribed to therefore has no further effect, and completes as soon as the subscription that is already in place is acknowledged. A single unsubscribe of that name undoes any number of subscriptions to it.

      Parameters:
      name - The QualifiedName of the Message.type() to subscribe to.
      Returns:
      A CompletableFuture that completes successfully when this connector subscribed to the given name.
    • unsubscribe

      boolean unsubscribe(QualifiedName name)
      Unsubscribes this connector from queries with the given name.

      Undoes any number of subscriptions to the given name, leaving no query of that name routed to this connector.

      Parameters:
      name - The QualifiedName of the Message.type() to unsubscribe from.
      Returns:
      true if unsubscribing was successful, false otherwise.
    • onIncomingQuery

      void onIncomingQuery(QueryBusConnector.Handler handler)
      Registers a handler to process incoming query messages.
      Parameters:
      handler - The handler responsible for managing incoming queries.