Record Class DistributedCommandBusConfiguration
java.lang.Object
java.lang.Record
org.axonframework.messaging.commandhandling.distributed.DistributedCommandBusConfiguration
- Record Components:
loadFactor- The load factor for theDistributedCommandBus.commandThreads- The number of threads used by theDistributedCommandBus.executorServiceFactory- TheExecutorServiceFactoryconstructing the priority-awareExecutorServicefor theDistributedCommandBus.
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 Summary
FieldsModifier and TypeFieldDescriptionstatic final DistributedCommandBusConfigurationA default instance of theDistributedCommandBusConfiguration, setting theloadFactor()to 100, thecommandThreads()to 10, and theexecutorServiceFactory()to a priority-awareExecutorServiceFactoryusing the configured number of threads. -
Constructor Summary
ConstructorsConstructorDescriptionDistributedCommandBusConfiguration(int loadFactor, int commandThreads, ExecutorServiceFactory<DistributedCommandBusConfiguration> executorServiceFactory) Compact constructor validating that the givenloadFactorandcommandThreadsare strictly positive. -
Method Summary
Modifier and TypeMethodDescriptionintReturns the value of thecommandThreadsrecord component.commandThreads(int commandThreads) Sets the number of threads to use for the distributed command bus.final booleanIndicates whether some other object is "equal to" this one.executorService(ExecutorService executorService) Sets theExecutorServiceto use for the distributed command bus.Returns the value of theexecutorServiceFactoryrecord component.final inthashCode()Returns a hash code value for this object.intReturns the value of theloadFactorrecord component.loadFactor(int loadFactor) Sets the load factor for the distributed command bus.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
DEFAULT
A default instance of theDistributedCommandBusConfiguration, setting theloadFactor()to 100, thecommandThreads()to 10, and theexecutorServiceFactory()to a priority-awareExecutorServiceFactoryusing the configured number of threads.
-
-
Constructor Details
-
DistributedCommandBusConfiguration
public DistributedCommandBusConfiguration(int loadFactor, int commandThreads, @Nonnull ExecutorServiceFactory<DistributedCommandBusConfiguration> executorServiceFactory) Compact constructor validating that the givenloadFactorandcommandThreadsare strictly positive.
-
-
Method Details
-
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
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
Sets theExecutorServiceto use for the distributed command bus. Defaults to a fixed thread pool with 10 threads.- Parameters:
executorService- TheExecutorServiceto use for the distributed command bus.- Returns:
- The configuration itself, for fluent API usage.
-
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. -
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. -
equals
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 withObjects::equals(Object,Object); primitive components are compared with '=='. -
loadFactor
public int loadFactor()Returns the value of theloadFactorrecord component.- Returns:
- the value of the
loadFactorrecord component
-
commandThreads
public int commandThreads()Returns the value of thecommandThreadsrecord component.- Returns:
- the value of the
commandThreadsrecord component
-
executorServiceFactory
Returns the value of theexecutorServiceFactoryrecord component.- Returns:
- the value of the
executorServiceFactoryrecord component
-