public class SessionSettings extends Object
Constructor and Description |
---|
SessionSettings() |
Modifier and Type | Method and Description |
---|---|
String |
getAccessKey()
Returns the access key that was assigned by the exchange.
|
String |
getFirm()
Returns the firm id that was assigned by the exchange.
|
MessageFilter |
getInboundMessageLogFilter()
Returns session inbound message log filter.
|
int |
getKeepAliveInterval()
Returns the longest time in milliseconds the client system can remain silent before sending a message.
|
long |
getListenerDelayWarningThreshold()
Returns the limit of time to spend in the listener code.
|
int |
getOutputQueueMaxSize()
Returns the maximum size of the internal output queue allocated for a connection, in bytes.
|
int |
getReasonableTransmissionTime()
Returns reasonable transmission time as % from keep alive interval value.
|
int[] |
getReceivingThreadAffinity()
Returns a processor affinity mask for the receiving thread.
|
int |
getReconnectAttempts()
Returns the number of attempts session will try to restore connection.
|
long |
getReconnectInterval()
Returns interval between reconnect attempts in milliseconds.
|
boolean |
getReportNewMessagesWhileWaitingForMissedMessages()
Returns whether to call
InboundApplicationMessageListener listener while waiting for missed messages. |
String |
getSecretKey()
Returns the secret key that was assigned by the exchange.
|
int[] |
getSendingThreadAffinity()
Returns a processor affinity mask for the sending thread.
|
long |
getSendSpinningTimeout()
Returns the current send spinning timeout value (in nanoseconds).
|
String |
getSession()
Returns the session id that was assigned by the exchange.
|
int |
getSocketPerfPreferenceBandwidth()
Returns socket performance preference for bandwidth.
|
int |
getSocketPerfPreferenceConnectionTime()
Returns socket performance preference for connection time.
|
int |
getSocketPerfPreferenceLatency()
Returns socket performance preference for latency.
|
int |
getSocketReceiveBufferSize()
Returns TCP socket receive buffer size allocated to FIX connection, in bytes.
|
int |
getSocketSendBufferSize()
Returns TCP socket send buffer size allocated to FIX connection, in bytes.
|
String |
getTemplateFile()
Returns path to template file describing how message fields are encoded and the generale of messages.
|
String |
getTradingSystemName()
Returns the trading system name.
|
String |
getTradingSystemVendor()
Returns the trading system vendor.
|
String |
getTradingSystemVersion()
Returns the trading system version.
|
void |
init(Settings settings)
Initializes the settings.
|
boolean |
isDetectMessageGapForPreviousUuid()
Returns whether to detect the message gap for the previous UUID.
|
boolean |
isEventArgReuse()
Returns whether to re-use session event argument objects.
|
boolean |
isInboundMessageReuse()
Returns whether SBE decoder will reuse pre-created messages or will create from scratch.
|
boolean |
isLogInboundMessages()
Returns whether to store inbound messages in the session storage.
|
boolean |
isLogOutboundMessages()
Returns whether to store outbound messages in the session storage.
|
boolean |
isSocketTcpNoDelay()
Returns TCP socket TCP_NODELAY parameter (disable/enable Nagle's algorithm).
|
SessionSettings |
setAccessKey(String accessKey)
Sets the access key that was assigned by the exchange.
|
SessionSettings |
setDetectMessageGapForPreviousUuid(boolean value)
Sets whether to detect the message gap for the previous UUID.
|
SessionSettings |
setEventArgReuse(boolean eventArgReuse)
Sets whether to re-use session event argument objects.
|
SessionSettings |
setFirm(String firm)
Sets the firm id that was assigned by the exchange.
|
SessionSettings |
setInboundMessageLogFilter(MessageFilter inboundMessageLogFilter)
Sets session inbound message log filter.
|
SessionSettings |
setInboundMessageReuse(boolean inboundMessageReuse)
Sets whether SBE decoder will reuse pre-created messages or will create from scratch.
|
SessionSettings |
setKeepAliveInterval(int keepAliveInterval)
Sets the longest time in milliseconds the client system can remain silent before sending a message.
|
SessionSettings |
setListenerDelayWarningThreshold(long listenerDelayWarningThreshold)
Sets the limit of time to spend in the listener code.
|
SessionSettings |
setLogInboundMessages(boolean logInboundMessages)
Sets whether to store inbound messages in the session storage.
|
SessionSettings |
setLogOutboundMessages(boolean logOutboundMessages)
Sets whether to store outbound messages in the session storage.
|
SessionSettings |
setOutputQueueMaxSize(int size)
Sets the maximum size of the internal output queue allocated for a connection, in bytes.
|
SessionSettings |
setReasonableTransmissionTime(int reasonableTransmissionTime)
Sets reasonable transmission time as % from keep alive interval value.
|
SessionSettings |
setReceivingThreadAffinity(int[] affinity)
Sets a processor affinity mask for the receiving thread.
|
SessionSettings |
setReconnectAttempts(int reconnectAttempts)
Sets the number of attempts session will try to restore connection.
|
SessionSettings |
setReconnectInterval(long reconnectInterval)
Sets interval between reconnect attempts in milliseconds.
|
SessionSettings |
setReportNewMessagesWhileWaitingForMissedMessages(boolean value)
Sets whether to call
InboundApplicationMessageListener listener while waiting for missed messages. |
SessionSettings |
setSecretKey(String secretKey)
Sets the secret key that was assigned by the exchange.
|
SessionSettings |
setSendingThreadAffinity(int[] affinity)
Sets a processor affinity mask for the sending thread.
|
SessionSettings |
setSendSpinningTimeout(long timeout)
Sets the current send spinning timeout value (in nanoseconds).
|
SessionSettings |
setSession(String session)
Sets the session id that was assigned by the exchange.
|
SessionSettings |
setSocketPerfPreferenceBandwidth(int socketPerfPreferenceBandwidth)
Sets socket performance preference for bandwidth.
|
SessionSettings |
setSocketPerfPreferenceConnectionTime(int socketPerfPreferenceConnectionTime)
Sets socket performance preference for connection time.
|
SessionSettings |
setSocketPerfPreferenceLatency(int socketPerfPreferenceLatency)
Sets socket performance preference for latency.
|
SessionSettings |
setSocketReceiveBufferSize(int socketReceiveBufferSize)
Sets TCP socket receive buffer size allocated to FIX connection, in bytes.
|
SessionSettings |
setSocketSendBufferSize(int socketSendBufferSize)
Sets TCP socket send buffer size allocated to FIX connection, in bytes.
|
SessionSettings |
setSocketTcpNoDelay(boolean socketTcpNoDelay)
Sets TCP socket TCP_NODELAY parameter (disable/enable Nagle's algorithm).
|
SessionSettings |
setTemplateFile(String templateFile)
Sets path to template file describing how message fields are encoded and the generale of messages.
|
SessionSettings |
setTradingSystemName(String tradingSystemName)
Sets the trading system name.
|
SessionSettings |
setTradingSystemVendor(String tradingSystemVendor)
Sets the trading system vendor.
|
SessionSettings |
setTradingSystemVersion(String tradingSystemVersion)
Sets the trading system version.
|
public static final String SESSION_PROP
public static final String SESSION_DEFAULT
public static final String FIRM_PROP
public static final String FIRM_DEFAULT
public static final String TRADING_SYSTEM_NAME_PROP
public static final String TRADING_SYSTEM_NAME_DEFAULT
public static final String TRADING_SYSTEM_VERSION_PROP
public static final String TRADING_SYSTEM_VERSION_DEFAULT
public static final String TRADING_SYSTEM_VENDOR_PROP
public static final String TRADING_SYSTEM_VENDOR_DEFAULT
public static final String KEEP_ALIVE_INTERVAL_PROP
public static final int KEEP_ALIVE_INTERVAL_DEFAULT
public static final String REASONABLE_TRANSMISSION_TIME_PROP
public static final int REASONABLE_TRANSMISSION_TIME_DEFAULT
public static final String EVENT_ARG_REUSE_PROP
public static final boolean EVENT_ARG_REUSE_DEFAULT
public static final String INBOUND_MESSAGE_REUSE_PROP
public static final boolean INBOUND_MESSAGE_REUSE_DEFAULT
public static final String LISTENER_DELAY_WARNING_THRESHOLD_PROP
public static final long LISTENER_DELAY_WARNING_THRESHOLD_DEFAULT
public static final String LOG_INBOUND_MESSAGE_PROP
public static final boolean LOG_INBOUND_MESSAGE_DEFAULT
public static final String LOG_OUTBOUND_MESSAGE_PROP
public static final boolean LOG_OUTBOUND_MESSAGE_DEFAULT
public static final String OUTPUT_QUEUE_MAX_SIZE_PROP
public static final int OUTPUT_QUEUE_MAX_SIZE_DEFAULT
public static final String SEND_SPINNING_TIMEOUT_PROP
public static final long SEND_SPINNING_TIMEOUT_DEFAULT
public static final String RECONNECT_ATTEMPTS_PROP
public static final int RECONNECT_ATTEMPTS_DEFAULT
public static final String RECONNECT_INTERVAL_PROP
public static final long RECONNECT_INTERVAL_DEFAULT
public static final String REPORT_NEW_MESSAGES_WHILE_WAITING_FOR_MISSED_MESSAGES_PROP
public static final boolean REPORT_NEW_MESSAGES_WHILE_WAITING_FOR_MISSED_MESSAGES_DEFAULT
public static final String DETECT_MESSAGE_GAP_FOR_PREVIOUS_UUID_PROP
public static final boolean DETECT_MESSAGE_GAP_FOR_PREVIOUS_UUID_DEFAULT
public static final String ACCESS_KEY_PROP
public static final String ACCESS_KEY_DEFAULT
public static final String SECRET_KEY_PROP
public static final String SECRET_KEY_DEFAULT
public static final String TEMPLATE_FILE_PROP
public static final String TEMPLATE_FILE_DEFAULT
public static final String SESSION_SOCKET_SEND_BUFFER_SIZE_PROP
public static final int SESSION_SOCKET_SEND_BUFFER_SIZE_DEFAULT
public static final String SESSION_SOCKET_RECEIVE_BUFFER_SIZE_PROP
public static final int SESSION_SOCKET_RECEIVE_BUFFER_SIZE_DEFAULT
public static final String SESSION_SOCKET_TCP_NO_DELAY_PROP
public static final boolean SESSION_SOCKET_TCP_NO_DELAY_DEFAULT
public static final String SESSION_SOCKET_PERF_PREFERENCE_CONNECTION_TIME_PROP
public static final int SESSION_SOCKET_PERF_PREFERENCE_CONNECTION_TIME_DEFAULT
public static final String SESSION_SOCKET_PERF_PREFERENCE_LATENCY_PROP
public static final int SESSION_SOCKET_PERF_PREFERENCE_LATENCY_DEFAULT
public static final String SESSION_SOCKET_PERF_PREFERENCE_BANDWIDTH_PROP
public static final int SESSION_SOCKET_PERF_PREFERENCE_BANDWIDTH_DEFAULT
public void init(Settings settings)
settings
- settings to initialize withNullPointerException
- if (settings == null)
IllegalArgumentException
- if settings has incorrect valuepublic String getSession()
SESSION_DEFAULT
.
SESSION_PROP
.public SessionSettings setSession(String session)
SESSION_DEFAULT
.
SESSION_PROP
.session
- string representation of the session id.public String getFirm()
FIRM_DEFAULT
.
FIRM_PROP
.public SessionSettings setFirm(String firm)
FIRM_DEFAULT
.
FIRM_PROP
.firm
- string representing firm id.public String getAccessKey()
ACCESS_KEY_DEFAULT
.
ACCESS_KEY_PROP
.public SessionSettings setAccessKey(String accessKey)
ACCESS_KEY_DEFAULT
.
ACCESS_KEY_PROP
.accessKey
- string representing access key.public String getSecretKey()
SECRET_KEY_DEFAULT
.
SECRET_KEY_PROP
.public SessionSettings setSecretKey(String secretKey)
SECRET_KEY_DEFAULT
.
SECRET_KEY_PROP
.secretKey
- string representing secret key.public String getTradingSystemName()
TRADING_SYSTEM_NAME_DEFAULT
.
TRADING_SYSTEM_NAME_PROP
.public SessionSettings setTradingSystemName(String tradingSystemName)
TRADING_SYSTEM_NAME_DEFAULT
.
TRADING_SYSTEM_NAME_PROP
.tradingSystemName
- string representing trading system name.public String getTradingSystemVersion()
TRADING_SYSTEM_VERSION_DEFAULT
.
TRADING_SYSTEM_VERSION_PROP
.public SessionSettings setTradingSystemVersion(String tradingSystemVersion)
TRADING_SYSTEM_VERSION_DEFAULT
.
TRADING_SYSTEM_VERSION_PROP
.tradingSystemVersion
- string representing trading system version.public String getTradingSystemVendor()
TRADING_SYSTEM_VENDOR_DEFAULT
.
TRADING_SYSTEM_VENDOR_PROP
.public SessionSettings setTradingSystemVendor(String tradingSystemVendor)
TRADING_SYSTEM_VENDOR_DEFAULT
.
TRADING_SYSTEM_VENDOR_PROP
.tradingSystemVendor
- string value representing trading system vendor.public int getKeepAliveInterval()
KEEP_ALIVE_INTERVAL_DEFAULT
.
KEEP_ALIVE_INTERVAL_PROP
.public SessionSettings setKeepAliveInterval(int keepAliveInterval)
KEEP_ALIVE_INTERVAL_DEFAULT
.
KEEP_ALIVE_INTERVAL_PROP
.keepAliveInterval
- allowed range is between 5000 - 60000. Any value outside this range will be rejected.public int getReasonableTransmissionTime()
REASONABLE_TRANSMISSION_TIME_DEFAULT
.
REASONABLE_TRANSMISSION_TIME_PROP
.public SessionSettings setReasonableTransmissionTime(int reasonableTransmissionTime)
REASONABLE_TRANSMISSION_TIME_DEFAULT
.
REASONABLE_TRANSMISSION_TIME_PROP
.reasonableTransmissionTime
- value in percents.public boolean isEventArgReuse()
EVENT_ARG_REUSE_DEFAULT
.
EVENT_ARG_REUSE_PROP
.true
to re-use, false
otherwise.public SessionSettings setEventArgReuse(boolean eventArgReuse)
EVENT_ARG_REUSE_DEFAULT
.
EVENT_ARG_REUSE_PROP
.eventArgReuse
- true
to re-use, false
otherwise.public boolean isInboundMessageReuse()
INBOUND_MESSAGE_REUSE_DEFAULT
.
INBOUND_MESSAGE_REUSE_PROP
.true
in case re-use is enabled, false
otherwise.public SessionSettings setInboundMessageReuse(boolean inboundMessageReuse)
INBOUND_MESSAGE_REUSE_DEFAULT
.
INBOUND_MESSAGE_REUSE_PROP
.inboundMessageReuse
- true
in case re-use is enabled, false
otherwise.public long getListenerDelayWarningThreshold()
LISTENER_DELAY_WARNING_THRESHOLD_DEFAULT
.
LISTENER_DELAY_WARNING_THRESHOLD_PROP
.public SessionSettings setListenerDelayWarningThreshold(long listenerDelayWarningThreshold)
LISTENER_DELAY_WARNING_THRESHOLD_DEFAULT
.
LISTENER_DELAY_WARNING_THRESHOLD_PROP
.listenerDelayWarningThreshold
- delay in milliseconds.public boolean isLogInboundMessages()
LOG_INBOUND_MESSAGE_DEFAULT
.
LOG_INBOUND_MESSAGE_PROP
.true
to store inbound messages, false
otherwise.public SessionSettings setLogInboundMessages(boolean logInboundMessages)
LOG_INBOUND_MESSAGE_DEFAULT
.
LOG_INBOUND_MESSAGE_PROP
.logInboundMessages
- true
to store inbound messages, false
otherwise.public boolean isLogOutboundMessages()
LOG_OUTBOUND_MESSAGE_DEFAULT
.
LOG_OUTBOUND_MESSAGE_PROP
.true
to store outbound messages, false
otherwise.public SessionSettings setLogOutboundMessages(boolean logOutboundMessages)
LOG_OUTBOUND_MESSAGE_DEFAULT
.
LOG_OUTBOUND_MESSAGE_PROP
.logOutboundMessages
- true
to store outbound messages, false
otherwise.public MessageFilter getInboundMessageLogFilter()
NullMessageFilter.INSTANCE
.public SessionSettings setInboundMessageLogFilter(MessageFilter inboundMessageLogFilter)
NullMessageFilter.INSTANCE
.inboundMessageLogFilter
- session inbound message log filter.public int getOutputQueueMaxSize()
OUTPUT_QUEUE_MAX_SIZE_DEFAULT
.
OUTPUT_QUEUE_MAX_SIZE_PROP
.
Note: If the output queue max size is reached Session.send(..) method call will throw an exception with the following message: The counterparty does not receive messages or receives too slow, sending buffer max size is reached.
public SessionSettings setOutputQueueMaxSize(int size)
OUTPUT_QUEUE_MAX_SIZE_DEFAULT
.
OUTPUT_QUEUE_MAX_SIZE_PROP
.
Note: If the output queue max size is reached Session.send(..) method call will throw an exception with the following message: The counterparty does not receive messages or receives too slow, sending buffer max size is reached.
size
- maximum size of internal output queue in bytes.public long getSendSpinningTimeout()
SEND_SPINNING_TIMEOUT_DEFAULT
.
SEND_SPINNING_TIMEOUT_PROP
.
Note:
This method can be used to decrease the latency of the data sending.
If the value is zero (by default) and the outgoing message cannot be sent immediately it is placed to the
outgoing queue.
If the value greater than zero, the send(..) method waits for the socket sending buffer availability in the
spin loop mode before placing the message to the outgoing queue.
public SessionSettings setSendSpinningTimeout(long timeout)
SEND_SPINNING_TIMEOUT_DEFAULT
.
SEND_SPINNING_TIMEOUT_PROP
.
Note:
This method can be used to decrease the latency of the data sending.
If the value is zero (by default) and the outgoing message cannot be sent immediately it is placed to the
outgoing queue.
If the value greater than zero, the send(..) method waits for the socket sending buffer availability in the
spin loop mode before placing the message to the outgoing queue.
timeout
- timeout in nanoseconds.public int[] getSendingThreadAffinity()
null
.public SessionSettings setSendingThreadAffinity(int[] affinity)
null
.affinity
- affinity mask for the sending thread.public int[] getReceivingThreadAffinity()
null
.public SessionSettings setReceivingThreadAffinity(int[] affinity)
null
.affinity
- affinity mask for the receiving thread.public int getReconnectAttempts()
RECONNECT_ATTEMPTS_DEFAULT
.
RECONNECT_ATTEMPTS_PROP
.public SessionSettings setReconnectAttempts(int reconnectAttempts)
RECONNECT_ATTEMPTS_DEFAULT
.
RECONNECT_ATTEMPTS_PROP
.reconnectAttempts
- the number of attempts. The value can be set to 0, to disable reconnecting.public long getReconnectInterval()
RECONNECT_INTERVAL_DEFAULT
.
RECONNECT_INTERVAL_PROP
.public SessionSettings setReconnectInterval(long reconnectInterval)
RECONNECT_INTERVAL_DEFAULT
.
RECONNECT_INTERVAL_PROP
.reconnectInterval
- interval in milliseconds.public boolean getReportNewMessagesWhileWaitingForMissedMessages()
InboundApplicationMessageListener
listener while waiting for missed messages.
REPORT_NEW_MESSAGES_WHILE_WAITING_FOR_MISSED_MESSAGES_DEFAULT
.
REPORT_NEW_MESSAGES_WHILE_WAITING_FOR_MISSED_MESSAGES_PROP
.true
to call InboundApplicationMessageListener
listener, false
otherwise.public SessionSettings setReportNewMessagesWhileWaitingForMissedMessages(boolean value)
InboundApplicationMessageListener
listener while waiting for missed messages.
REPORT_NEW_MESSAGES_WHILE_WAITING_FOR_MISSED_MESSAGES_DEFAULT
.
REPORT_NEW_MESSAGES_WHILE_WAITING_FOR_MISSED_MESSAGES_PROP
.value
- true
to call InboundApplicationMessageListener
listener, false
otherwise.public boolean isDetectMessageGapForPreviousUuid()
DETECT_MESSAGE_GAP_FOR_PREVIOUS_UUID_DEFAULT
.
DETECT_MESSAGE_GAP_FOR_PREVIOUS_UUID_PROP
.true
to detect the message gap for the previous UUID, false
otherwise..public SessionSettings setDetectMessageGapForPreviousUuid(boolean value)
DETECT_MESSAGE_GAP_FOR_PREVIOUS_UUID_DEFAULT
.
DETECT_MESSAGE_GAP_FOR_PREVIOUS_UUID_PROP
.value
- true
to detect the message gap for the previous UUID, false
otherwise.public String getTemplateFile()
TEMPLATE_FILE_DEFAULT
.
TEMPLATE_FILE_PROP
.public SessionSettings setTemplateFile(String templateFile)
TEMPLATE_FILE_DEFAULT
.
TEMPLATE_FILE_PROP
.templateFile
- path to the template file to be used by session.public int getSocketSendBufferSize()
SESSION_SOCKET_SEND_BUFFER_SIZE_DEFAULT
.
SESSION_SOCKET_SEND_BUFFER_SIZE_PROP
.public SessionSettings setSocketSendBufferSize(int socketSendBufferSize)
SESSION_SOCKET_SEND_BUFFER_SIZE_DEFAULT
.
SESSION_SOCKET_SEND_BUFFER_SIZE_PROP
.socketSendBufferSize
- the size to which to set the send buffer size. This value must be greater than 0.public int getSocketReceiveBufferSize()
SESSION_SOCKET_RECEIVE_BUFFER_SIZE_DEFAULT
.
SESSION_SOCKET_RECEIVE_BUFFER_SIZE_PROP
.public SessionSettings setSocketReceiveBufferSize(int socketReceiveBufferSize)
SESSION_SOCKET_RECEIVE_BUFFER_SIZE_DEFAULT
.
SESSION_SOCKET_RECEIVE_BUFFER_SIZE_PROP
.socketReceiveBufferSize
- the size to which to set the receive buffer size.
This value must be greater than 0.public boolean isSocketTcpNoDelay()
SESSION_SOCKET_TCP_NO_DELAY_DEFAULT
.
SESSION_SOCKET_TCP_NO_DELAY_PROP
.true
when TCP_NODELAY is enabled, false
when disabled.public SessionSettings setSocketTcpNoDelay(boolean socketTcpNoDelay)
SESSION_SOCKET_TCP_NO_DELAY_DEFAULT
.
SESSION_SOCKET_TCP_NO_DELAY_PROP
.socketTcpNoDelay
- true
to enable TCP_NODELAY, false
to disable.public int getSocketPerfPreferenceConnectionTime()
SESSION_SOCKET_PERF_PREFERENCE_CONNECTION_TIME_DEFAULT
.
SESSION_SOCKET_PERF_PREFERENCE_CONNECTION_TIME_PROP
.public SessionSettings setSocketPerfPreferenceConnectionTime(int socketPerfPreferenceConnectionTime)
Socket.setPerformancePreferences(int, int, int)
for details.
SESSION_SOCKET_PERF_PREFERENCE_CONNECTION_TIME_DEFAULT
.
SESSION_SOCKET_PERF_PREFERENCE_CONNECTION_TIME_PROP
.socketPerfPreferenceConnectionTime
- An int expressing the relative importance of a short connection time.public int getSocketPerfPreferenceLatency()
SESSION_SOCKET_PERF_PREFERENCE_LATENCY_DEFAULT
.
SESSION_SOCKET_PERF_PREFERENCE_LATENCY_PROP
.public SessionSettings setSocketPerfPreferenceLatency(int socketPerfPreferenceLatency)
Socket.setPerformancePreferences(int, int, int)
for details.
SESSION_SOCKET_PERF_PREFERENCE_LATENCY_DEFAULT
.
SESSION_SOCKET_PERF_PREFERENCE_LATENCY_PROP
.socketPerfPreferenceLatency
- An int expressing the relative importance of low latency.public int getSocketPerfPreferenceBandwidth()
SESSION_SOCKET_PERF_PREFERENCE_BANDWIDTH_DEFAULT
.
SESSION_SOCKET_PERF_PREFERENCE_BANDWIDTH_PROP
.public SessionSettings setSocketPerfPreferenceBandwidth(int socketPerfPreferenceBandwidth)
Socket.setPerformancePreferences(int, int, int)
for details.
SESSION_SOCKET_PERF_PREFERENCE_BANDWIDTH_DEFAULT
.
SESSION_SOCKET_PERF_PREFERENCE_BANDWIDTH_PROP
.socketPerfPreferenceBandwidth
- An int expressing the relative importance of high bandwidth.Copyright © 2005–2024 Onix Solutions. All rights reserved.