Class AxonServerConfiguration

java.lang.Object
org.axonframework.axonserver.connector.AxonServerConfiguration

@ConfigurationProperties(prefix="axon.axonserver") public class AxonServerConfiguration extends Object
Configuration class provided configurable fields and defaults for anything Axon Server related.
Since:
4.0
Author:
Marc Gathier, Steven van Beelen
  • Constructor Details

  • Method Details

    • builder

      public static AxonServerConfiguration.Builder builder()
      Returns:
      a AxonServerConfiguration.Builder to be able to create an AxonServerConfiguration.
    • isEnabled

      public boolean isEnabled()
      Whether (automatic) configuration of the Axon Server Connector is enabled. When false, the connector will not be implicitly be configured. Defaults to true.

      Note that this setting will only affect automatic configuration by Application Containers (such as Spring).

      Returns:
      Whether (automatic) configuration of the Axon Server Connector is enabled.
    • isShortcutQueriesToLocalHandlers

      public boolean isShortcutQueriesToLocalHandlers()
    • setShortcutQueriesToLocalHandlers

      public void setShortcutQueriesToLocalHandlers(boolean shortcutQueriesToLocalHandlers)
    • setEnabled

      public void setEnabled(boolean enabled)
      Set whether (automatic) configuration of the Axon Server Connector is enabled. When false, the connector will not be implicitly be configured. Defaults to true.

      Note that this setting will only affect automatic configuration by Application Containers (such as Spring).

      Parameters:
      enabled - Whether (automatic) configuration of the Axon Server Connector is enabled.
    • getServers

      public String getServers()
      Comma separated list of Axon Server servers. Each element is hostname or hostname:grpcPort. When no grpcPort is specified, default port 8124 is used.
      Returns:
      Comma separated list of Axon Server servers.
    • setServers

      public void setServers(String routingServers)
      Set the comma separated list of Axon Server servers. Each element is hostname or hostname:grpcPort. When no grpcPort is specified, default port 8124 is used.
      Parameters:
      routingServers - The comma separated list of Axon Server servers to connect with.
    • getClientId

      public String getClientId()
      The client identifier as it registers itself to Axon Server, must be unique.
      Returns:
      The client identifier as it registers itself to Axon Server, must be unique.
    • isAutoPersistentStreamsEnable

      public boolean isAutoPersistentStreamsEnable()
    • setAutoPersistentStreamsEnable

      public void setAutoPersistentStreamsEnable(boolean autoPersistentStreamsEnable)
    • setClientId

      public void setClientId(String clientId)
      Sets the client identifier as it registers itself to Axon Server, must be unique.
      Parameters:
      clientId - The client identifier as it registers itself to Axon Server, must be unique.
    • getComponentName

      public String getComponentName()
      The name of this application. Multiple instances of the same application share the same application name, but each must have a different client identifier. Defaults to spring.application.name when not defined, and to Unnamed + client identifier when spring.application.name isn't set.
      Returns:
      The name of this application.
    • setComponentName

      public void setComponentName(String componentName)
      Sets the name of this application. Multiple instances of the same application share the same application name, but each must have a different client identifier. Defaults to spring.application.name when not defined, and to Unnamed + client identifier when spring.application.name isn't set.
      Parameters:
      componentName - The name of this application.
    • getToken

      public String getToken()
      The token providing access control with Axon Server.\
      Returns:
      The token providing access control with Axon Server.
    • setToken

      public void setToken(String token)
      Sets the token providing access control with Axon Server.
      Parameters:
      token - The token providing access control with Axon Server.
    • getContext

      public String getContext()
      The bounded context that this application operates in. Defaults to "default".
      Returns:
      The bounded context that this application operates in.
    • setContext

      public void setContext(String context)
      Sets the bounded context that this application operates in. Defaults to "default".
      Parameters:
      context - The bounded context that this application operates in.
    • getCertFile

      public String getCertFile()
      The path to the certificate file used for SSL. Note the path is only used when SSL is enabled.
      Returns:
      The path to the certificate file used for SSL.
    • setCertFile

      public void setCertFile(String certFile)
      Sets the path to the certificate file used for SSL. Note the path is only used when SSL is enabled.
      Parameters:
      certFile - The path to the certificate file used for SSL.
    • isSslEnabled

      public boolean isSslEnabled()
      A toggle dictating whether to use TLS for the connection to Axon Server.\
      Returns:
      A toggle dictating whether to use TLS for the connection to Axon Server.
    • setSslEnabled

      public void setSslEnabled(boolean sslEnabled)
      Defines whether to use TLS for the connection to Axon Server.
      Parameters:
      sslEnabled - The toggle dictating whether to use TLS for the connection to Axon Server.
    • getPermits

      public Integer getPermits()
      The initial number of permits send for message streams (events, commands, queries). Defaults to 5000 permits.
      Returns:
      The initial number of permits send for message streams (events, commands, queries).
    • setPermits

      public void setPermits(Integer permits)
      Sets the initial number of permits send for message streams (events, commands, queries). Defaults to 5000 permits.
      Parameters:
      permits - The initial number of permits send for message streams (events, commands, queries).
    • getNrOfNewPermits

      public Integer getNrOfNewPermits()
      Additional number of permits send for message streams (events, commands, queries) when application is ready for more messages.

      A value of null, 0, and negative values will have the client request the number of permits required to get from the "new-permits-threshold" to "initial-nr-of-permits".

      Returns:
      The additional number of permits send for message streams (events, commands, queries) when application is ready for more messages.
    • setNrOfNewPermits

      public void setNrOfNewPermits(Integer nrOfNewPermits)
      Sets the additional number of permits send for message streams (events, commands, queries) when application is ready for more messages.

      A value of null, 0, and negative values will have the client request the number of permits required to get from the "new-permits-threshold" to "initial-nr-of-permits".

      Parameters:
      nrOfNewPermits - The additional number of permits send for message streams (events, commands, queries) when application is ready for more messages.
    • getNewPermitsThreshold

      public Integer getNewPermitsThreshold()
      The threshold at which the application sends new permits to server.

      A value of null, 0, and negative values will have the threshold set to 50% of the initial number of permits.

      Returns:
      The threshold at which the application sends new permits to server.
    • setNewPermitsThreshold

      public void setNewPermitsThreshold(Integer newPermitsThreshold)
      Sets the threshold at which the application sends new permits to server.

      A value of null, 0, and negative values will have the threshold set to 50% of the initial number of permits.

      Parameters:
      newPermitsThreshold - The threshold at which the application sends new permits to server.
    • getEventFlowControl

      Specific flow control settings for the event message stream.

      When not specified (null) the top-level flow control properties permits, nrOfNewPermits and newPermitsThreshold are used.

      Returns:
      Specific flow control settings for the event message stream.
    • setEventFlowControl

      public void setEventFlowControl(AxonServerConfiguration.FlowControlConfiguration eventFlowControl)
      Sets specific flow control settings for the event message stream.

      When not specified (null) the top-level flow control properties permits, nrOfNewPermits and newPermitsThreshold are used.

      Parameters:
      eventFlowControl - Specific flow control settings for the event message stream.
    • getQueryFlowControl

      Specific flow control settings for the query message stream.

      When not specified (null) the top-level flow control properties permits, nrOfNewPermits and newPermitsThreshold are used.

      Returns:
      Specific flow control settings for the query message stream.
    • setQueryFlowControl

      public void setQueryFlowControl(AxonServerConfiguration.FlowControlConfiguration queryFlowControl)
      Sets specific flow control settings for the query message stream.

      When not specified (null) the top-level flow control properties permits, nrOfNewPermits and newPermitsThreshold are used.

      Parameters:
      queryFlowControl - Specific flow control settings for the query message stream.
    • getCommandFlowControl

      public AxonServerConfiguration.FlowControlConfiguration getCommandFlowControl()
      Specific flow control settings for the command message stream.

      When not specified (null) the top-level flow control properties permits, nrOfNewPermits and newPermitsThreshold are used.

      Returns:
      Specific flow control settings for the command message stream.
    • setCommandFlowControl

      public void setCommandFlowControl(AxonServerConfiguration.FlowControlConfiguration commandFlowControl)
      Sets specific flow control settings for the command message stream.

      When not specified (null) the top-level flow control properties permits, nrOfNewPermits and newPermitsThreshold are used.

      Parameters:
      commandFlowControl - Specific flow control settings for the command message stream.
    • getDefaultFlowControlConfiguration

      public AxonServerConfiguration.FlowControlConfiguration getDefaultFlowControlConfiguration()
      The default flow control settings used when no specific command, event, or query flow control settings are provided.
      Returns:
      The default flow control settings used when no specific command, event, or query flow control settings are provided.
    • getCommandThreads

      public int getCommandThreads()
      The number of threads executing commands. Defaults to 10 threads.
      Returns:
      The number of threads executing commands.
    • setCommandThreads

      public void setCommandThreads(int commandThreads)
      Sets the number of threads executing commands. Defaults to 10 threads.
      Parameters:
      commandThreads - The number of threads executing commands.
    • getQueryThreads

      public int getQueryThreads()
      The number of threads executing queries. Defaults to 10 threads.
      Returns:
      The number of threads executing queries.
    • setQueryThreads

      public void setQueryThreads(int queryThreads)
      Sets the number of threads executing queries. Defaults to 10 threads.
      Parameters:
      queryThreads - The number of threads executing queries.
    • getQueryResponseThreads

      public int getQueryResponseThreads()
      The number of threads executing query responses. Defaults to 5 threads.
      Returns:
      The number of threads executing query responses.
    • setQueryResponseThreads

      public void setQueryResponseThreads(int queryResponseThreads)
      Sets the number of threads executing query responses. Defaults to 5 threads.
      Parameters:
      queryResponseThreads - The number of threads executing query responses.
    • getProcessorsNotificationRate

      public int getProcessorsNotificationRate()
      The interval (in ms.) application sends status update on event processors to Axon Server. Defaults to 500 milliseconds.
      Returns:
      The interval (in ms.) application sends status update on event processors to Axon Server.
    • setProcessorsNotificationRate

      public void setProcessorsNotificationRate(int processorsNotificationRate)
      Sets the interval (in ms.) application sends status update on event processors to Axon Server. Defaults to 500 milliseconds.
      Parameters:
      processorsNotificationRate - The interval (in ms.) application sends status update on event processors to Axon Server.
    • getProcessorsNotificationInitialDelay

      public int getProcessorsNotificationInitialDelay()
      The initial delay (in ms.) before application sends first status update on event processors to Axon Server. Defaults to 5000 milliseconds.
      Returns:
      The initial delay (in ms.) before application sends first status update on event processors to Axon Server.
    • setProcessorsNotificationInitialDelay

      public void setProcessorsNotificationInitialDelay(int processorsNotificationInitialDelay)
      Sets the initial delay (in ms.) before application sends first status update on event processors to Axon Server. Defaults to 5000 milliseconds.
      Parameters:
      processorsNotificationInitialDelay - The initial delay (in ms.) before application sends first status update on event processors to Axon Server.
    • getKeepAliveTimeout

      public long getKeepAliveTimeout()
      The timeout (in ms) for keep alive requests. Defaults to 5000 milliseconds.
      Returns:
      The timeout (in ms) for keep alive requests.
    • setKeepAliveTimeout

      public void setKeepAliveTimeout(long keepAliveTimeout)
      Sets the timeout (in ms) for keep alive requests. Defaults to 5000 milliseconds.
      Parameters:
      keepAliveTimeout - The timeout (in ms) for keep alive requests.
    • getKeepAliveTime

      public long getKeepAliveTime()
      The interval (in ms) for keep alive requests, 0 is keep-alive disabled. Defaults to 1000 milliseconds.
      Returns:
      The interval (in ms) for keep alive requests, 0 is keep-alive disabled.
    • setKeepAliveTime

      public void setKeepAliveTime(long keepAliveTime)
      Sets the interval (in ms) for keep alive requests, 0 is keep-alive disabled. Defaults to 1000 milliseconds.
      Parameters:
      keepAliveTime - The interval (in ms) for keep alive requests, 0 is keep-alive disabled.
    • getSnapshotPrefetch

      public int getSnapshotPrefetch()
      An int indicating the maximum number of Aggregate snapshots which will be retrieved. Defaults to 1.
      Returns:
      An int indicating the maximum number of Aggregate snapshots which will be retrieved.
    • setSnapshotPrefetch

      public void setSnapshotPrefetch(int snapshotPrefetch)
      Sets the maximum number of Aggregate snapshots which will be retrieved. Defaults to 1.
      Parameters:
      snapshotPrefetch - The maximum number of Aggregate snapshots which will be retrieved.
    • getMaxMessageSize

      public int getMaxMessageSize()
      The gRPC max inbound message size. Defaults to 0, keeping the default value from the connector.
      Returns:
      The gRPC max inbound message size.
    • setMaxMessageSize

      public void setMaxMessageSize(int maxMessageSize)
      Sets the gRPC max inbound message size. Defaults to 0, keeping the default value from the connector.
      Parameters:
      maxMessageSize - The gRPC max inbound message size.
    • getMaxMessageSizeWarningThreshold

      public double getMaxMessageSizeWarningThreshold()
      The threshold (in percentage of 0-1) of the max message size at which a warning should be logged. Defaults to 0.8.
      Returns:
      The threshold (in percentage of 0 to 1) of the max outbound message size at which a warning should be logged.
    • setMaxMessageSizeWarningThreshold

      public void setMaxMessageSizeWarningThreshold(double maxMessageSizeWarningThreshold)
      The threshold (in percentage of 0-1) of the max message size at which a warning should be logged. Defaults to 0.8.
      Parameters:
      maxMessageSizeWarningThreshold - The threshold (in percentage of 0 to 1) of the max outbound message size at which a warning should be logged.
    • getCommandLoadFactor

      public int getCommandLoadFactor()
      An int representing the fixed value of load factor sent to Axon Server for any command's subscription if no specific implementation of CommandLoadFactorProvider is configured. The default value is 100.
      Returns:
      An int representing the fixed value of load factor sent to Axon Server for any command's subscription if no specific implementation of CommandLoadFactorProvider is configured.
    • setCommandLoadFactor

      public void setCommandLoadFactor(int commandLoadFactor)
      Sets an int representing the fixed value of load factor sent to Axon Server for any command's subscription if no specific implementation of CommandLoadFactorProvider is configured. The default value is 100.
      Parameters:
      commandLoadFactor - An int representing the fixed value of load factor sent to Axon Server for any command's subscription if no specific implementation of CommandLoadFactorProvider is configured.
    • getConnectTimeout

      public long getConnectTimeout()
      A value representing the maximum time in milliseconds a request for the initial Axon Server connection may last. Defaults to 5000 (5 seconds).
      Returns:
      A value representing the maximum time in milliseconds a request for the initial Axon Server connection may last.
    • setConnectTimeout

      public void setConnectTimeout(long connectTimeout)
      Sets the value representing the maximum time in milliseconds a request for the initial Axon Server connection may last. Defaults to 5000 (5 seconds).
      Parameters:
      connectTimeout - The value representing the maximum time in milliseconds a request for the initial Axon Server connection may last.
    • getReconnectInterval

      public long getReconnectInterval()
      The amount of time in milliseconds to wait in between attempts to connect to Axon Server. A single attempt involves connecting to each of the configured servers.

      Defaults to 2000 (2 seconds).

      Returns:
      The amount of time in milliseconds to wait in between attempts to connect to Axon Server.
    • setReconnectInterval

      public void setReconnectInterval(long reconnectInterval)
      Sets the amount of time in milliseconds to wait in between attempts to connect to Axon Server. A single attempt involves connecting to each of the configured servers.

      Defaults to 2000 (2 seconds).

      Parameters:
      reconnectInterval - The amount of time in milliseconds to wait in between attempts to connect to Axon Server.
    • isForceReadFromLeader

      public boolean isForceReadFromLeader()
      Indicates whether it is OK to query events from the local Axon Server node - the node the client is currently connected to. This means that the client will probably get stale events since all events my not be replicated to this node yet. Can be used when the criteria for eventual consistency is less strict. It will spread the load for querying events - not all requests will go to the leader of the cluster anymore.

      If Axon Server SE is used, this property has no effect.

      Returns:
      An indication whether it is OK to query events from the local Axon Server node - the node the client is currently connected to.
    • setForceReadFromLeader

      public void setForceReadFromLeader(boolean forceReadFromLeader)
      Sets the indicator whether it is OK to query events from the local Axon Server node - the node the client is currently connected to. This means that the client will probably get stale events since all events my not be replicated to this node yet. Can be used when the criteria for eventual consistency is less strict. It will spread the load for querying events - not all requests will go to the leader of the cluster anymore.

      If Axon Server SE is used, this property has no effect.

      Parameters:
      forceReadFromLeader - The indicator whether it is OK to query events from the local Axon Server node - the node the client is currently connected to.
    • isForceReconnectThroughServers

      public boolean isForceReconnectThroughServers()
      Indicates whether the AxonServerConnectionManager should always reconnect through the servers or try to reconnect with the server it just lost the connection with.

      When true (default), the AxonServerConnectionManager will contact the servers for a new destination each time a connection is dropped. When false, the connector will first attempt to re-establish a connection to the node it was previously connected to. When that fails, only then will it contact the servers.

      Default to true, forcing the failed connection to be abandoned and a new one to be requested via the routing servers.

      Returns:
      An indication whether the AxonServerConnectionManager should always reconnect through the servers or try to reconnect with the server it just lost the connection with.
    • setForceReconnectThroughServers

      public void setForceReconnectThroughServers(boolean forceReconnectThroughServers)
      Sets the indicator whether the AxonServerConnectionManager should always reconnect through the servers or try to reconnect with the server it just lost the connection with.

      When true (default), the AxonServerConnectionManager will contact the servers for a new destination each time a connection is dropped. When false, the connector will first attempt to re-establish a connection to the node it was previously connected to. When that fails, only then will it contact the servers.

      Default to true, forcing the failed connection to be abandoned and a new one to be requested via the routing servers.

      Parameters:
      forceReconnectThroughServers - The indicator whether the AxonServerConnectionManager should always reconnect through the servers or try to reconnect with the server it just lost the connection with.
    • getConnectionManagementThreadPoolSize

      public int getConnectionManagementThreadPoolSize()
      The number of threads that should be used for connection management activities by the AxonServerConnectionFactory used by the AxonServerConnectionManager.

      This includes activities related to connecting to Axon Server, setting up instruction streams, sending and validating heartbeats, etc.

      Defaults to a pool size of 2 threads.

      Returns:
      The number of threads that should be used for connection management activities by the AxonServerConnectionFactory used by the AxonServerConnectionManager.
    • setConnectionManagementThreadPoolSize

      public void setConnectionManagementThreadPoolSize(int connectionManagementThreadPoolSize)
      Define the number of threads that should be used for connection management activities by the AxonServerConnectionFactory used by the AxonServerConnectionManager.

      This includes activities related to connecting to Axon Server, setting up instruction streams, sending and validating heartbeats, etc.

      Defaults to a pool size of 2 threads.

      Parameters:
      connectionManagementThreadPoolSize - The number of threads that should be used for connection management activities by the AxonServerConnectionFactory used by the AxonServerConnectionManager.
    • getHeartbeat

      The configuration specifics on sending heartbeat messages to ensure a fully operational end-to-end connection with Axon Server.
      Returns:
      The configuration specifics on sending heartbeat messages to ensure a fully operational end-to-end connection with Axon Server.
    • setHeartbeat

      public void setHeartbeat(AxonServerConfiguration.HeartbeatConfiguration heartbeat)
      Sets the configuration specifics on sending heartbeat messages to ensure a fully operational end-to-end connection with Axon Server.
      Parameters:
      heartbeat - The configuration specifics on sending heartbeat messages to ensure a fully operational end-to-end connection with Axon Server.
    • getEventhandling

      public AxonServerConfiguration.Eventhandling getEventhandling()
      Return the configured AxonServerConfiguration.Eventhandling of this application for Axon Server.
      Returns:
      The configured AxonServerConfiguration.Eventhandling of this application for Axon Server.
    • setEventhandling

      public void setEventhandling(AxonServerConfiguration.Eventhandling eventhandling)
      Set the AxonServerConfiguration.Eventhandling of this application for Axon Server
      Parameters:
      eventhandling - The AxonServerConfiguration.Eventhandling to set for this application.
    • getEventStoreConfiguration

      @ConfigurationProperties(prefix="axon.axonserver.event-store") public AxonServerConfiguration.EventStoreConfiguration getEventStoreConfiguration()
      Return the configured AxonServerConfiguration.EventStoreConfiguration of this application for Axon Server.
      Returns:
      The configured AxonServerConfiguration.EventStoreConfiguration of this application for Axon Server.
    • setEventStoreConfiguration

      public void setEventStoreConfiguration(AxonServerConfiguration.EventStoreConfiguration eventStoreConfiguration)
      Set the AxonServerConfiguration.EventStoreConfiguration of this application for Axon Server
      Parameters:
      eventStoreConfiguration - The AxonServerConfiguration.EventStoreConfiguration to set for this application.