Interface ServerConfig

All Superinterfaces:
Config

public interface ServerConfig extends Config
Server Configuration.

Suitable defaults exist for all configurable values (see below) so it is possible to create a working server without any special configuration being set.

At least one connector should be configured to allow client connections. However, if no connectors are configured when the server is started then two default connectors will be automatically created as follows:-

1) "Client Connector"
Using a default web server (see below) and listening on port 8080.
All other configuration values will default.
This connector would be suitable for normal client connections.

2) "High Volume Connector"
Using a default web server (see below) and listening on port 8090.
This will use the "LargeQueue" queue definition. If this queue does not exist it will be created with a maximum depth of 100,000.
It will have input and output socket buffers configured at 1Mb and a recovery buffer size of 10,000.
This connector would be suitable for high throughput connections, such as secondary remote or fan-out servers or bulk updater clients.

If connectors need to be set up automatically then they will use the first configured web server. If no web server has been configured then one will be created called "default" which will be suitable for web socket client connections and supporting an HTTP prometheus service.

Since:
4.4
  • Method Details

    • setServerName

      void setServerName(String name) throws ConfigException
      Sets the server name.

      The server name is used to identify this server if running in a cluster. This will also be used as a prefix for client IDs.

      If not specified the local host name will be used.

      Parameters:
      name - the server name
      Throws:
      ConfigException - if unable to set the server name
    • getServerName

      String getServerName()
      Returns the server name.
      Returns:
      server name
    • setPersistenceDirectory

      void setPersistenceDirectory(String path) throws ConfigException
      Sets the name of a directory under which persistent files will be maintained.

      This may be an absolute or relative directory path. If relative then the directory will be beneath the Diffusion home directory.

      If this is not specified, the setting in PersistenceConfig#getStoreDirectory will be considered, but if not specified there then a directory called 'persistence' under the Diffusion home directory will be used.

      The directory will be created if it does not already exist when the server starts.

      Parameters:
      path - specifies an absolute or relative (to the Diffusion home directory) path for the directory which is to contain persistence files
      Throws:
      ConfigException - if the configuration is locked
      Since:
      6.3
    • getPersistenceDirectory

      String getPersistenceDirectory()
      Returns the persistence home directory, if one has been specified.
      Returns:
      the persistence directory path
      Since:
      6.3
      See Also:
    • setMaximumMessageSize

      void setMaximumMessageSize(int maxMessageSize) throws ConfigException
      Sets the maximum message size.

      This is used as a safeguard as a size that no inbound message may exceed.

      Parameters:
      maxMessageSize - The maximum message size in bytes. This defines the maximum message size (including headers) that can be received. The default is 256 KiB.
      Throws:
      ConfigException - if the specified maximum message size is invalid.
    • getMaximumMessageSize

      int getMaximumMessageSize()
      Returns the configured maximum message size.
      Returns:
      the configured maximum message size.
    • setDefaultLogDirectory

      void setDefaultLogDirectory(String directory) throws ConfigException
      Sets the default log directory path.

      The directory is used for the daily ConnectionCount statistics file and multiplexer diagnostic files, and is used to resolve the console-monitored log file.

      If not set, the default path is "logs".

      If the path is relative, it is evaluated relative to the Diffusion installation directory.

      Parameters:
      directory - the default log directory
      Throws:
      ConfigException - if unable to set the property
      Since:
      6.9
    • getDefaultLogDirectory

      String getDefaultLogDirectory()
      Gets the default log directory.
      Returns:
      default log directory
      Since:
      6.9
    • setConsoleMonitoredLog

      void setConsoleMonitoredLog(String path) throws ConfigException
      Sets the console monitored log path.

      Specifies the log file made available to the Diffusion management console. This should be configured to match etc/log4j2.xml.

      If not set, the default path is "Server.log".

      If the path is relative, it is evaluated relative to the default log directory.

      Parameters:
      path - the console monitored log path
      Throws:
      ConfigException - if unable to set the property
      Since:
      6.9
    • getConsoleMonitoredLog

      String getConsoleMonitoredLog()
      Gets the console monitored log path.
      Returns:
      console monitored log path
      Since:
      6.9
    • getTimeouts

      TimeoutsConfig getTimeouts()
      Gets the timeouts configuration.

      This allows connection timeouts to be configured.

      Returns:
      timeouts configuration - will not be null
    • getThreads

      ThreadsConfig getThreads()
      Gets the Threads configuration.

      This allows concurrency related properties to be configured, including defining thread pools.

      Returns:
      thread pools configuration - will not be null.
    • getConnectors

      List<ConnectorConfig> getConnectors()
      Returns the list of connectors defined for this server.
      Returns:
      list of defined connectors. This may be empty if none have been defined.
    • getConnector

      ConnectorConfig getConnector(String name)
      Get the configuration for a named connector.
      Parameters:
      name - the connector name
      Returns:
      the connector configuration or null if no such connector is defined
    • addConnector

      ConnectorConfig addConnector(String name) throws ConfigException
      Add a connector.

      Connectors may only be configured before the server is started.

      Parameters:
      name - the connector name
      Returns:
      the new connector configuration.
      Throws:
      ConfigException - if unable to add connector
    • getMultiplexerConfiguration

      MultiplexerConfig getMultiplexerConfiguration()
      Get the multiplexer configuration.
      Returns:
      the multiplexer configuration
      Since:
      5.6
    • getWebServers

      List<WebServerConfig> getWebServers()
      Gets the list of configured web servers.
      Returns:
      list of web servers which may be empty if none configured.
    • getWebServer

      WebServerConfig getWebServer(String webServerName)
      Get a named Web Server configuration.
      Parameters:
      webServerName - the web server name
      Returns:
      web server configuration or null if there is no web server configured with the given name.
    • addWebServer

      WebServerConfig addWebServer(String webServerName) throws ConfigException
      Add a new Web Server Configuration.

      Web server configurations are used to specify the Web server behavior of connectors that wish to handle HTTP connections or act as file servers.

      Parameters:
      webServerName - the Web Server Name which must be unique.
      Returns:
      the new Web Server Configuration
      Throws:
      ConfigException - if unable to add Web Server configuration
    • getSecurity

      SecurityConfig getSecurity()
      Gets the security configuration details.

      This allows server specific security details such as the name of an authorisation handler class.

      Returns:
      security configuration details - will not be null
    • getGeoIp

      GeoIpConfig getGeoIp()
      Gets the Geo IP config details.

      This allows details relating o the GeoIp database to be defined. Normally this would not need to be changed in any way as default behavior is usually what is required.

      Returns:
      Geo IP configuration - will not be null
    • getUserLibraries

      UserLibrariesConfig getUserLibraries()
      Gets the user library configuration.

      This allows a set of user libraries from which user written code may be loaded to be defined.

      Returns:
      user library configuration - will not be null
    • getHooks

      HooksConfig getHooks()
      Gets the Server Hooks Configuration.

      This allows server hooks such as startUp and shutDown hooks to be defined.

      Returns:
      hooks config - will not be null
    • getManagement

      ManagementConfig getManagement()
      Get Management configuration.

      This allows system management details to be defined.

      Returns:
      management configuration - will not be null
    • getMimes

      MimesConfig getMimes()
      Get mime types configuration.

      Common mime types used in HTTP deployments.

      Returns:
      mime types configuration - will not be null
    • getStatistics

      StatisticsConfig getStatistics()
      Get statistics configuration.

      Allows the statistics that are to be produced to be configured.

      At this point in time this is minimal.

      Returns:
      statistics configuration
    • getReplication

      ReplicationConfig getReplication()
      Get replication configuration.

      The replication configuration is used to control the replication of sessions or topics across a cluster.

      Returns:
      Replication configuration
    • getLogging

      Deprecated.
      since 6.9
      Get the logging configuration.

      This allows logging properties to be configured.

      Returns:
      logging configuration
    • getSelectorThreadPools

      SelectorThreadPoolsConfig getSelectorThreadPools()
      Gets the selector thread pools configuration. It allows fine grained tuning for performance optimisation purposes.
      Returns:
      the selector thread pool configuration.
      Since:
      5.5
    • getFanOut

      Deprecated.
      since 6.11

      Fan-out is deprecated and will be removed in a future release. Use Remote Servers in preference.

      Get the FanOut configuration.

      This is used to configure a secondary server to connect to a primary server in fan out mode.

      Returns:
      the fan out configuration.
      Since:
      5.6
    • getQueues

      QueuesConfig getQueues()
      Gets the queues configuration details.

      This allows queue definitions to be configured.

      Returns:
      queues configuration - will not be null.
    • getPersistence

      PersistenceConfig getPersistence()
      Get the persistence configuration details.

      This is used to configure the topic persistence service.

      Returns:
      persistence configuration - will not be null
      Since:
      6.0
    • getJournal

      JournalConfig getJournal()
      Gets the Journal configuration details.
      Returns:
      journal configuration - will not be null
      Since:
      6.12