Record Class DistributedCommandBusConfiguration

java.lang.Object
java.lang.Record
org.axonframework.messaging.commandhandling.distributed.DistributedCommandBusConfiguration
Record Components:
loadFactor - The load factor for the DistributedCommandBus.
commandThreads - The number of threads used by the DistributedCommandBus.
executorServiceFactory - The ExecutorServiceFactory constructing the priority-aware ExecutorService for the DistributedCommandBus.

public record DistributedCommandBusConfiguration(int loadFactor, int commandThreads, @Nonnull ExecutorServiceFactory<DistributedCommandBusConfiguration> executorServiceFactory) extends Record
Configuration for the DistributedCommandBus.

Can be used to modify non-critical settings of the bus, such as the load factor and thread pool.

Since:
5.0.0
Author:
Mitchell Herrijgers, Steven van Beelen
  • Field Details

  • Constructor Details

    • DistributedCommandBusConfiguration

      public DistributedCommandBusConfiguration(int loadFactor, int commandThreads, @Nonnull ExecutorServiceFactory<DistributedCommandBusConfiguration> executorServiceFactory)
      Compact constructor validating that the given loadFactor and commandThreads are strictly positive.
  • Method Details

    • loadFactor

      public DistributedCommandBusConfiguration loadFactor(int loadFactor)
      Sets the load factor for the distributed command bus. The load factor determines how many commands are sent to each application that is part of the distributed command bus. A higher load factor means that more commands are sent to this node compared to others. Defaults to 100.
      Parameters:
      loadFactor - The load factor to use for the distributed command bus.
      Returns:
      The configuration itself, for fluent API usage.
    • commandThreads

      public DistributedCommandBusConfiguration commandThreads(int commandThreads)
      Sets the number of threads to use for the distributed command bus. Defaults to 10.
      Parameters:
      commandThreads - The number of threads to use for the distributed command bus.
      Returns:
      The configuration itself, for fluent API usage.
    • executorService

      public DistributedCommandBusConfiguration executorService(@Nonnull ExecutorService executorService)
      Sets the ExecutorService to use for the distributed command bus. Defaults to a fixed thread pool with 10 threads.
      Parameters:
      executorService - The ExecutorService to use for the distributed command bus.
      Returns:
      The configuration itself, for fluent API usage.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • loadFactor

      public int loadFactor()
      Returns the value of the loadFactor record component.
      Returns:
      the value of the loadFactor record component
    • commandThreads

      public int commandThreads()
      Returns the value of the commandThreads record component.
      Returns:
      the value of the commandThreads record component
    • executorServiceFactory

      @Nonnull public ExecutorServiceFactory<DistributedCommandBusConfiguration> executorServiceFactory()
      Returns the value of the executorServiceFactory record component.
      Returns:
      the value of the executorServiceFactory record component