Class DelegatingQueryBusConnector

java.lang.Object
org.axonframework.messaging.queryhandling.distributed.DelegatingQueryBusConnector
All Implemented Interfaces:
DescribableComponent, QueryBusConnector
Direct Known Subclasses:
PayloadConvertingQueryBusConnector

public abstract class DelegatingQueryBusConnector extends Object implements QueryBusConnector
A QueryBusConnector implementation that wraps another QueryBusConnector and delegates all calls to it.

This can be used to add additional functionality through decoration to a QueryBusConnector without having to implement all methods again.

Since:
5.0.0
Author:
Steven van Beelen
  • Field Details

  • Constructor Details

    • DelegatingQueryBusConnector

      protected DelegatingQueryBusConnector(@Nonnull QueryBusConnector delegate)
      Initialize the delegating QueryBusConnector to delegate all calls to the given delegate.
      Parameters:
      delegate - The QueryBusConnector to delegate all calls to.
  • Method Details

    • query

      @Nonnull public MessageStream<QueryResponseMessage> query(@Nonnull QueryMessage query, @Nullable ProcessingContext context)
      Description copied from interface: QueryBusConnector
      Sends the given query to the remote QueryBus.
      Specified by:
      query in interface QueryBusConnector
      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 public MessageStream<QueryResponseMessage> subscriptionQuery(@Nonnull QueryMessage query, @Nullable ProcessingContext context, int updateBufferSize)
      Description copied from interface: QueryBusConnector
      Sends the given query to the remote QueryBus.
      Specified by:
      subscriptionQuery in interface QueryBusConnector
      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

      public CompletableFuture<Void> subscribe(@Nonnull QualifiedName name)
      Description copied from interface: QueryBusConnector
      Subscribes this connector to queries matching the given name.
      Specified by:
      subscribe in interface QueryBusConnector
      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

      public boolean unsubscribe(@Nonnull QualifiedName name)
      Description copied from interface: QueryBusConnector
      Unsubscribes this connector from queries with the given name.
      Specified by:
      unsubscribe in interface QueryBusConnector
      Parameters:
      name - The QualifiedName of the Message.type() to unsubscribe from.
      Returns:
      true if unsubscribing was successful, false otherwise.
    • onIncomingQuery

      public void onIncomingQuery(@Nonnull QueryBusConnector.Handler handler)
      Description copied from interface: QueryBusConnector
      Registers a handler to process incoming query messages.
      Specified by:
      onIncomingQuery in interface QueryBusConnector
      Parameters:
      handler - The handler responsible for managing incoming queries.
    • describeTo

      public void describeTo(@Nonnull ComponentDescriptor descriptor)
      Description copied from interface: DescribableComponent
      Describe the properties of this DescribableComponent with the given descriptor.

      Components should call the appropriate describeProperty methods on the descriptor to register their properties. The descriptor is responsible for determining how these properties are formatted and structured in the final output.

      Best Practices: As a general rule, all relevant fields of a DescribableComponent implementation should be described in this method. However, developers have discretion to include only the fields that make sense in the context. Not every field may be meaningful for description purposes, especially internal implementation details. Furthermore, components might want to expose different information based on their current state. The final decision on what properties to include lies with the person implementing the describeTo method, who should focus on providing information that is useful for understanding the component's configuration and state.

      Example implementation:

       public void describeTo(ComponentDescriptor descriptor) {
           descriptor.describeProperty("name", this.name);
           descriptor.describeProperty("enabled", this.enabled);
           descriptor.describeProperty("configuration", this.configuration); // A nested component
           descriptor.describeProperty("handlers", this.eventHandlers);      // A collection
       }
       
      Specified by:
      describeTo in interface DescribableComponent
      Parameters:
      descriptor - The component descriptor to describe this DescribableComponentn its properties in.