Class DefaultQueryBusSpanFactory

java.lang.Object
org.axonframework.queryhandling.DefaultQueryBusSpanFactory
All Implemented Interfaces:
QueryBusSpanFactory

public class DefaultQueryBusSpanFactory extends Object implements QueryBusSpanFactory
Default implementation of the QueryBusSpanFactory. Can be configured to include the query handling of a distributed query in the same trace or not (true by default).
Since:
4.9.0
Author:
Mitchell Herrijgers
  • Constructor Details

  • Method Details

    • createQuerySpan

      public Span createQuerySpan(QueryMessage<?,?> queryMessage, boolean distributed)
      Description copied from interface: QueryBusSpanFactory
      Creates a span for a query.
      Specified by:
      createQuerySpan in interface QueryBusSpanFactory
      Parameters:
      queryMessage - The query message being dispatched.
      distributed - Whether the query is from a distributed source.
      Returns:
      The span for the handling of the query.
    • createSubscriptionQuerySpan

      public Span createSubscriptionQuerySpan(SubscriptionQueryMessage<?,?,?> queryMessage, boolean distributed)
      Description copied from interface: QueryBusSpanFactory
      Creates a span for a subscription query.
      Specified by:
      createSubscriptionQuerySpan in interface QueryBusSpanFactory
      Parameters:
      queryMessage - The subscription query message being dispatched.
      distributed - Whether the subscription query is from a distributed source.
      Returns:
      The span for the handling of the subscription query.
    • createSubscriptionQueryProcessUpdateSpan

      public Span createSubscriptionQueryProcessUpdateSpan(SubscriptionQueryUpdateMessage<?> updateMessage, SubscriptionQueryMessage<?,?,?> queryMessage)
      Description copied from interface: QueryBusSpanFactory
      Creates a span for processing a subscription query update that has been received from the server.
      Specified by:
      createSubscriptionQueryProcessUpdateSpan in interface QueryBusSpanFactory
      Parameters:
      updateMessage - The update message being handled.
      queryMessage - The subscription query message that the update is for.
      Returns:
      The span for the processing of the subscription query update.
    • createScatterGatherSpan

      public Span createScatterGatherSpan(QueryMessage<?,?> queryMessage, boolean distributed)
      Description copied from interface: QueryBusSpanFactory
      Creates a span for a scatter-gather query.
      Specified by:
      createScatterGatherSpan in interface QueryBusSpanFactory
      Parameters:
      queryMessage - The query message being handled.
      distributed - Whether the query is from a distributed source.
      Returns:
      The span for the handling of the scatter-gather query.
    • createScatterGatherHandlerSpan

      public Span createScatterGatherHandlerSpan(QueryMessage<?,?> queryMessage, int handlerIndex)
      Description copied from interface: QueryBusSpanFactory
      Creates a span for one of the handlers of a scatter-gather query. There can be multiple for the same within one application. The handler index is used to distinguish between them.
      Specified by:
      createScatterGatherHandlerSpan in interface QueryBusSpanFactory
      Parameters:
      queryMessage - The query message being handled.
      handlerIndex - The index of the handler. Starts at 0.
      Returns:
      The span for the handling of the scatter-gather query.
    • createStreamingQuerySpan

      public Span createStreamingQuerySpan(QueryMessage<?,?> queryMessage, boolean distributed)
      Description copied from interface: QueryBusSpanFactory
      Creates a span for a streaming query.
      Specified by:
      createStreamingQuerySpan in interface QueryBusSpanFactory
      Parameters:
      queryMessage - The query message being dispatched.
      distributed - Whether the query is from a distributed source.
      Returns:
      The span for the handling of the streaming query.
    • createQueryProcessingSpan

      public Span createQueryProcessingSpan(QueryMessage<?,?> queryMessage)
      Description copied from interface: QueryBusSpanFactory
      Creates a span for processing a query. Distributed implementations can use this to create a span for the entire query processing on the handling side.
      Specified by:
      createQueryProcessingSpan in interface QueryBusSpanFactory
      Parameters:
      queryMessage - The query message being handled.
      Returns:
      The span for the processing of the query.
    • createResponseProcessingSpan

      public Span createResponseProcessingSpan(QueryMessage<?,?> queryMessage)
      Description copied from interface: QueryBusSpanFactory
      Creates a span for processing a response. Distributed implementations can use this to create a span for the entire response processing on the sending side.
      Specified by:
      createResponseProcessingSpan in interface QueryBusSpanFactory
      Parameters:
      queryMessage - The query message the response is for.
      Returns:
      The span for the processing of the response.
    • propagateContext

      public <T, R, M extends QueryMessage<T, R>> M propagateContext(M queryMessage)
      Description copied from interface: QueryBusSpanFactory
      Propagates the context of the current span to the given queryMessage.
      Specified by:
      propagateContext in interface QueryBusSpanFactory
      Type Parameters:
      T - The type of the payload of the query message.
      R - The type of the response of the query message.
      M - The type of the query message.
      Parameters:
      queryMessage - The query message to propagate the context to.
      Returns:
      The query message with the context of the current span.
    • builder

      public static DefaultQueryBusSpanFactory.Builder builder()
      Creates a Builder to be able to create a DefaultQueryBusSpanFactory. The default values are:
      • distributedInSameTrace defaults to true
      The spanFactory is a required field and should be provided.
      Returns:
      a Builder to be able to create a DefaultQueryBusSpanFactory