Record Class DistributedQueryBusConfiguration
java.lang.Object
java.lang.Record
org.axonframework.messaging.queryhandling.distributed.DistributedQueryBusConfiguration
- Record Components:
queryThreads- The number of threads used by theDistributedQueryBusfor querying.queryExecutorServiceFactory- TheExecutorServiceFactoryconstructing the priority-awareExecutorServicefor querying in theDistributedQueryBus.queryResponseThreads- The number of threads used by theDistributedQueryBusfor handling query responses.queryResponseExecutorServiceFactory- TheExecutorServiceFactoryconstructing the priority-awareExecutorServicefor handling query responses in theDistributedQueryBus.
public record DistributedQueryBusConfiguration(int queryThreads, @Nonnull ExecutorServiceFactory<DistributedQueryBusConfiguration> queryExecutorServiceFactory, int queryResponseThreads, @Nonnull ExecutorServiceFactory<DistributedQueryBusConfiguration> queryResponseExecutorServiceFactory)
extends Record
Configuration for the
DistributedQueryBus.
Can be used to modify non-critical settings of the bus, such as the query and query response thread pools.
- Since:
- 5.0.0
- Author:
- Steven van Beelen
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final DistributedQueryBusConfigurationA default instance of theDistributedQueryBusConfiguration, setting thequeryThreads()to 10, thequeryResponseThreads()to 5, and thequeryExecutorServiceFactory()andqueryResponseExecutorServiceFactory()to priority-awareExecutorServiceFactoriesusing the configured number of threads. -
Constructor Summary
ConstructorsConstructorDescriptionDistributedQueryBusConfiguration(int queryThreads, ExecutorServiceFactory<DistributedQueryBusConfiguration> queryExecutorServiceFactory, int queryResponseThreads, ExecutorServiceFactory<DistributedQueryBusConfiguration> queryResponseExecutorServiceFactory) Compact constructor validating that the givenqueryThreadsandqueryResponseThreadsare strictly positive. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.queryExecutorService(ExecutorService executorService) Sets theExecutorServiceto use for querying in the distributed query bus.Returns the value of thequeryExecutorServiceFactoryrecord component.queryResponseExecutorService(ExecutorService executorService) Sets theExecutorServiceto use for handling query responses in the distributed query bus.Returns the value of thequeryResponseExecutorServiceFactoryrecord component.intReturns the value of thequeryResponseThreadsrecord component.queryResponseThreads(int queryResponseThreads) Sets the number of threads to use for handling query responses in the distributed query bus.intReturns the value of thequeryThreadsrecord component.queryThreads(int queryThreads) Sets the number of threads to use for querying in the distributed query bus.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
DEFAULT
A default instance of theDistributedQueryBusConfiguration, setting thequeryThreads()to 10, thequeryResponseThreads()to 5, and thequeryExecutorServiceFactory()andqueryResponseExecutorServiceFactory()to priority-awareExecutorServiceFactoriesusing the configured number of threads.
-
-
Constructor Details
-
DistributedQueryBusConfiguration
public DistributedQueryBusConfiguration(int queryThreads, @Nonnull ExecutorServiceFactory<DistributedQueryBusConfiguration> queryExecutorServiceFactory, int queryResponseThreads, @Nonnull ExecutorServiceFactory<DistributedQueryBusConfiguration> queryResponseExecutorServiceFactory) Compact constructor validating that the givenqueryThreadsandqueryResponseThreadsare strictly positive.
-
-
Method Details
-
queryThreads
Sets the number of threads to use for querying in the distributed query bus.Defaults to 10.
- Parameters:
queryThreads- The number of threads to use for the distributed query bus.- Returns:
- The configuration itself, for fluent API usage.
-
queryExecutorService
public DistributedQueryBusConfiguration queryExecutorService(@Nonnull ExecutorService executorService) Sets theExecutorServiceto use for querying in the distributed query bus.Defaults to a fixed thread pool with 10 threads using the priority queue.
- Parameters:
executorService- TheExecutorServiceto use for querying in the distributed query bus.- Returns:
- The configuration itself, for fluent API usage.
-
queryResponseThreads
Sets the number of threads to use for handling query responses in the distributed query bus.Defaults to 5.
- Parameters:
queryResponseThreads- The number of threads to use for the distributed query bus.- Returns:
- The configuration itself, for fluent API usage.
-
queryResponseExecutorService
public DistributedQueryBusConfiguration queryResponseExecutorService(@Nonnull ExecutorService executorService) Sets theExecutorServiceto use for handling query responses in the distributed query bus.Defaults to a fixed thread pool with 5 threads using the priority queue.
- Parameters:
executorService- TheExecutorServiceto use for handling queries in the distributed query 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 '=='. -
queryThreads
public int queryThreads()Returns the value of thequeryThreadsrecord component.- Returns:
- the value of the
queryThreadsrecord component
-
queryExecutorServiceFactory
@Nonnull public ExecutorServiceFactory<DistributedQueryBusConfiguration> queryExecutorServiceFactory()Returns the value of thequeryExecutorServiceFactoryrecord component.- Returns:
- the value of the
queryExecutorServiceFactoryrecord component
-
queryResponseThreads
public int queryResponseThreads()Returns the value of thequeryResponseThreadsrecord component.- Returns:
- the value of the
queryResponseThreadsrecord component
-
queryResponseExecutorServiceFactory
@Nonnull public ExecutorServiceFactory<DistributedQueryBusConfiguration> queryResponseExecutorServiceFactory()Returns the value of thequeryResponseExecutorServiceFactoryrecord component.- Returns:
- the value of the
queryResponseExecutorServiceFactoryrecord component
-