Class TracingQueryBusConnector

java.lang.Object
io.axoniq.framework.messaging.queryhandling.distributed.tracing.TracingQueryBusConnector
All Implemented Interfaces:
QueryBusConnector, DescribableComponent

@Internal public final class TracingQueryBusConnector extends Object implements QueryBusConnector
Type-preserving tracing decorator for QueryBusConnector.

Opens a producer span around the send leg (query(QueryMessage, ProcessingContext) and subscriptionQuery(QueryMessage, ProcessingContext, int)) and a consumer span around the receive leg (onIncomingQuery handler invocation). These connector legs nest between the local bus dispatch / handle spans produced by TracingQueryBus and become observable only over a real transport.

This decorator is registered by DistributedTracingConfigurationEnhancer; it is never instantiated directly by applications.

Since:
5.3.0
Author:
Mateusz Nowak
  • Constructor Details

    • TracingQueryBusConnector

      public TracingQueryBusConnector(QueryBusConnector delegate, SpanFactory spanFactory)
      Initializes a tracing QueryBusConnector wrapping the given delegate, obtaining spans from the given spanFactory.
      Parameters:
      delegate - the connector to delegate to
      spanFactory - the factory producing the tracing spans
  • Method Details

    • query

      public MessageStream<QueryResponseMessage> query(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

      public MessageStream<QueryResponseMessage> subscriptionQuery(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(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(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(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(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.