Class DefaultCommandBusSpanFactory

java.lang.Object
org.axonframework.messaging.commandhandling.tracing.DefaultCommandBusSpanFactory
All Implemented Interfaces:
CommandBusSpanFactory

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

    • DefaultCommandBusSpanFactory

      protected DefaultCommandBusSpanFactory(DefaultCommandBusSpanFactory.Builder builder)
      Creates a new DefaultCommandBusSpanFactory using the provided builder.
      Parameters:
      builder - The builder to build the DefaultCommandBusSpanFactory from.
  • Method Details

    • createDispatchCommandSpan

      public Span createDispatchCommandSpan(CommandMessage commandMessage, boolean distributed)
      Description copied from interface: CommandBusSpanFactory
      Creates a span for the dispatching of a command.
      Specified by:
      createDispatchCommandSpan in interface CommandBusSpanFactory
      Parameters:
      commandMessage - The command message to create a span for.
      distributed - Whether the command is distributed or not.
      Returns:
      The created span.
    • createHandleCommandSpan

      public Span createHandleCommandSpan(CommandMessage commandMessage, boolean distributed)
      Description copied from interface: CommandBusSpanFactory
      Creates a span for the handling of a command.
      Specified by:
      createHandleCommandSpan in interface CommandBusSpanFactory
      Parameters:
      commandMessage - The command message to create a span for.
      distributed - Whether the command is distributed or not.
      Returns:
      The created span.
    • propagateContext

      public CommandMessage propagateContext(CommandMessage commandMessage)
      Description copied from interface: CommandBusSpanFactory
      Propagates the context of the current span to the given command message.
      Specified by:
      propagateContext in interface CommandBusSpanFactory
      Parameters:
      commandMessage - The command message to propagate the context to.
      Returns:
      The command message with the propagated context.
    • builder

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