Interface ServerConfig
- All Superinterfaces:
Config
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 Summary
Modifier and TypeMethodDescriptionaddConnector
(String name) Add a connector.addWebServer
(String webServerName) Add a new Web Server Configuration.getConnector
(String name) Get the configuration for a named connector.Returns the list of connectors defined for this server.Gets the console monitored log path.Gets the default log directory.Deprecated.since 6.11getGeoIp()
Gets the Geo IP config details.getHooks()
Gets the Server Hooks Configuration.Gets the Journal configuration details.Deprecated.since 6.9Get Management configuration.int
Returns the configured maximum message size.getMimes()
Get mime types configuration.Get the multiplexer configuration.Get the persistence configuration details.Returns the persistence home directory, if one has been specified.Gets the queues configuration details.Get replication configuration.Gets the security configuration details.Gets the selector thread pools configuration.Returns the server name.Get statistics configuration.Gets the Threads configuration.Gets the timeouts configuration.Gets the user library configuration.getWebServer
(String webServerName) Get a named Web Server configuration.Gets the list of configured web servers.void
setConsoleMonitoredLog
(String path) Sets the console monitored log path.void
setDefaultLogDirectory
(String directory) Sets the default log directory path.void
setMaximumMessageSize
(int maxMessageSize) Sets the maximum message size.void
Sets the name of a directory under which persistent files will be maintained.void
setServerName
(String name) Sets the server name.
-
Method Details
-
setServerName
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
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 islocked
- 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
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
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
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
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
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
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
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.9Get 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.11Fan-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
-