KeySessionContext
Class
trading.keysquare.api.session.KeySessionContext
A KeySessionContext is required when creating a Session. This defines the configuration used for connectivity etc.
This class can be used directly or in conjunction with Config, which will bootstrap configuration from properties files.
KeySessionContext context = new KeySessionContext();
context.applicationName("sample-subscriber");
...
When used in conjunction with Config, the following values can be set in property files:
Application
| Property | Description |
|---|---|
| APP_NAME | This is the application name to use to connect to KeySquare. This app name must be pre-registered in KeyAccess and permissioned to access relevant data |
| APP_CPUS | Defines the cpu(s) available to pin application threads |
| KS_APP_API_KEY | The api key to use when registering application on start up |
| KS_APP_APPLICATION_IDLE_STRATEGY | The idle strategy to use for the application thread when it has no messages to process, defaults to SleepingMillisIdleStrategy |
| KS_APP_CONCURRENCY_MODE | Defines the concurrency mode of publication - when more than on thread will be publishing data the CONCURRENT mode should be used |
| KS_APP_SESSION_THREAD_NAME | Defines the thread name to use by the session |
| KS_APP_EDIT_API_SUPPORTED | Can be used to disable the Edit API - this can provide slightly improved performance in certain cases. |
| KS_APP_SHUTDOWN_HOOK_ENABLED | Can be used to disable the shutdown hook that gets automatically registered by the session |
| KS_APP_AUTO_RECONNECT | Can be used to prevent automatic reconnection of the session following a disconnect |
| KS_APP_AUTO_RECONNECT_APPLY_SUBSCRIPTIONS | Can be used to prevent the automatic application of subscriptions when an application is reconnected following a disconnect |
| KS_APP_AUTO_RECONNECT_REPUBLISH | Can be used to prevent the automatic republication of data when an application is reconnected following a disconnect |
Transport
| Property | Description |
|---|---|
| KS_APP_TRANSPORT_MODE | The transport mode to use, e.g. IPC_UDP or TCP |
| KS_APP_TRANSPORT_EVENT_LIMIT | Defines the batch size of events being processed |
| KS_APP_TRANSPORT_IPC_UDP_DIR | The location of the aeron directory to use when in IPC_UDP mode |
| KS_APP_TRANSPORT_IPC_UDP_INTERFACE | The network interface to use when in IPC_UDP mode |
| KS_APP_TRANSPORT_TCP_BUFFER_SIZE | The TCP buffer size when operating in TCP mode |
Monitoring
| Property | Description |
|---|---|
| KS_APP_MONITORING_HEALTH_DIRECTORY | Defines the health directory in which to write a health file once an application submits a LifeCycle Status of Online |
| KS_APP_MONITORING_BUFFER_SIZE | The monitoring buffer size |
| KS_APP_MONITORING_IDLE_STRATEGY | The monitoring thread idle strategy, defaults to SleepingMillisIdleStrategy |
| KS_APP_MONITORING_HEARTBEAT_INTERVAL_MILLIS | The heartbeat interval in milliseconds |
| KS_APP_MONITORING_HEARTBEAT_TIMEOUT_MILLIS | The heartbeat timeout in milliseconds |
KeyAccess
| Property | Description |
|---|---|
| KS_APP_KEY_ACCESS_URL | The URL location of the Key Access application used for application registration |
Constructors
KeySessionContext()
Default constructor allowing configuration to be set via code.
KeySessionContext(trading.keysquare.api.config.Config config)
Constructor that can be used in conjunction with Config.