public final class SessionOptions extends Object
Currently the following options are supported
serverHost - The hostname or the ip address of the API
server
serverPort - The port number where the API server
accepts
connections
maxSendCacheSize - Maximum number of bytes that will be
cached by the Session before requests will
fail
maxEventQueueSize - The maximum number of events that can be
buffered by the Session. The value of
maxEventQueueSize must be greater than
zero.
maxPendingRequests - The maximum number of requests that can be
pending
allowMultipeCorrelatorsPerMsg - If a message is to be delivered for
multiple correlators then deliver one
message with all correlators folded into
that one message
slowConsumerWarningHiWaterMark - Set the fraction of 'maxEventQueueSize' at
which "slow consumer" events will be
generated. A warning event will be
generated when the number of outstanding
undelivered events passes above
'slowConsumerWarningHiWaterMark *
maxEventQueueSize'. The following is
applicable 0.0 <
slowConsumerWarningHiWaterMark <=
1.0. Further, at the time that
Session.start() is called, it must be the
case that
slowConsumerWarningLoWaterMark *
maxEventQueueSize <
slowConsumerWarningHiWaterMark *
maxEventQueueSize.
slowConsumerWarningLoWaterMark - Set the fraction of 'maxEventQueueSize' at
which "slow consumer cleared" events will
be generated. A warning cleared event will
be generated when the number of
outstanding undelivered events drops
below 'slowConsumerWarningLoWaterMark *
maxEventQueueSize'. The following is
applicable 0.0 <=
slowConsumerWarningLoWaterMark <
1.0. Further, at the time that
Session.start() is called, it must be the
case that
slowConsumerWarningLoWaterMark *
maxEventQueueSize <
slowConsumerWarningHiWaterMark *
maxEventQueueSize.
defaultSubscriptionService - The name of the service to be used by
default for subscriptions
defaultTopicPrefix - The name of the topic prefix to be used
for subscriptions if one is not provided
clientMode - see SessionOptions.ClientMode
serverAddresses - List of server addresses (hostname and
port) where the API servers are running.
autoRestartOnDisconnection - On disconnection from the back end should
the session connect again to the next
available API server
numStartAttempts - The number of connection failures before
session gives give up on connection
connectTimeout - Timeout in milliseconds for session to
establish a connection
defaultKeepAliveInactivityTime - Amount of time in milliseconds without any
read activity on the connection before the
library will ping the peer (requires
compatible server).
defaultKeepAliveResponseTimeout - Timeout for the ping response in
milliseconds. The peer will be declared
"dead" if no ping response (or other data)
is received within response timeout
interval after the ping (requires
compatible server).
keepAliveEnabled - Whether all keep-alive mechanisms, both
from the client to the server and from
the server to the client, should be
enabled.
recordSubscriptionDataReceiveTimes
- Should the receipt time (accessed via
Message.timeReceivedMillis()) be
recorded for subscription data messages.
TlsOptions - Use TLS when establishing connection to
the API Server. If non-null, contains the
client credentials and trust material that
should be used to establish secure
authenticated connections to the backend.
A null TlsOptions (the default) indicates
plaintext communication with the endpoints
to which the session connects.
bandwidthSaveModeDisabled - Flag indicating whether the client has
requested to override bandwidth saving
measures, such as conflation for snapshot
subscriptions. By default it is 'false'.
sessionIdentityOptions - Authorization options that enable
automatic authorization of the session
identity during startup.
| Modifier and Type | Class and Description |
|---|---|
static class |
SessionOptions.ClientMode
Enumerations describing client mode of Session
|
static class |
SessionOptions.ServerAddress |
| Constructor and Description |
|---|
SessionOptions()
Construct a SessionOption with well defined defaults for various options
Currently the following defaults are applied
|
| Modifier and Type | Method and Description |
|---|---|
String |
authenticationOptions()
Returns authentication options as a string.
|
boolean |
getAllowMultipleCorrelatorsPerMsg()
Returns the value of the allow multiple correlators per message option
in this instance.
|
boolean |
getAutoRestartOnDisconnection()
Returns if enabled to automatically restart connection on disconnection.
|
boolean |
getBandwidthSaveModeDisabled()
Return the value of the flag indicating whether the client has
disabled bandwidth saving measures.
|
SessionOptions.ClientMode |
getClientMode()
Returns the value of the client mode option in this instance.
|
int |
getConnectTimeout()
Returns the value of the connection timeout option in this instance in
milliseconds.
|
int |
getDefaultKeepAliveInactivityTime()
Returns the interval (in milliseconds) a connection has to remain
inactive (receive no data) before a keep alive probe will be sent.
|
int |
getDefaultKeepAliveResponseTimeout()
Returns the time (in milliseconds) the library will wait for response to
a keep alive probe before declaring it lost.
|
String[] |
getDefaultServices()
Deprecated.
as of 3.7.0, use
getDefaultSubscriptionService()
instead |
String |
getDefaultSubscriptionService()
Returns the default subscription service option.
|
String |
getDefaultTopicPrefix()
Returns the default topic prefix option.
|
int |
getMaxEventQueueSize()
Returns the value of maximum outstanding undelivered events that the
session is configured with.
|
int |
getMaxOutstandingRequests()
Returns the value of maximum outstanding requests that the session is
configured with.
|
int |
getMaxPendingRequests()
Returns the value of the maximum pending request option in this
instance.
|
int |
getMaxSendCacheSize() |
boolean |
getRecordSubscriptionDataReceiveTimes()
Returns if the receipt time (accessed via
Message.timeReceivedMillis()) should be recorded for
subscription data messages. |
SessionOptions.ServerAddress[] |
getServerAddresses()
Returns the list of server addresses that this session is configured to
connect to.
|
String |
getServerHost()
Returns the value of the server host option in this instance.
|
int |
getServerPort()
Returns the server port that this session connects to.
|
int |
getServiceCheckTimeout()
Returns the value of the service check timeout option in this instance
in milliseconds.
|
int |
getServiceDownloadTimeout()
Returns the value of the service download timeout option in this
instance in milliseconds.
|
float |
getSlowConsumerWarningHiWaterMark()
Returns the fraction of maxEventQueueSize at which "slow consumer" event
will be generated.
|
float |
getSlowConsumerWarningLoWaterMark()
Returns the fraction of maxEventQueueSize at which "slow consumer
cleared" event will be generated.
|
TlsOptions |
getTlsOptions()
Returns the TLS options used to configure secure communication with
endpoints.
|
int |
numStartAttempts()
Return the maximum number of attempts to retry establishing each
connection (so that at least one connection has been established) when
starting the session.
|
void |
setAllowMultipleCorrelatorsPerMsg(boolean allowMultipleCorrelatorsPerMsg)
Sets whether the Session is allowed to associate more than one
CorrelationId with a Message to the specified
'allowMultipleCorrelatorsPerMsg'.
|
void |
setAuthenticationOptions(String authOptions)
Sets the specified 'authOptions' as authentication option.
|
void |
setAutoRestartOnDisconnection(boolean autoRestartOnDisconnection)
Sets option of automatically restarting connection if disconnected.
|
void |
setBandwidthSaveModeDisabled(boolean isDisabled)
Set the flag to indicate whether the client has requested to disable
bandwidth saving measures.
|
void |
setClientMode(SessionOptions.ClientMode clientMode)
Sets how to connect to the API.
|
void |
setConnectTimeout(int timeoutMilliSeconds)
Sets the connection timeout in milliseconds when connecting to the API.
|
void |
setDefaultKeepAliveInactivityTime(int inactivityMsecs)
Sets to the specified 'inactivityMsecs' the amount of time in
milli-seconds that no traffic can be received on a connection before the
ping-based keep-alive mechanism is triggered; if no traffic is received
for this duration then a keep-alive ping is sent to the remote end to
solicit a response.
|
void |
setDefaultKeepAliveResponseTimeout(int timeoutMsecs)
Sets the default keep live response timeout interval in milliseconds.
|
void |
setDefaultSubscriptionService(String defaultSubscriptionService)
Sets the default service for subscriptions which do not specify a
subscription server to the specified 'serviceIdentifier'.
|
void |
setDefaultTopicPrefix(String defaultTopicPrefix)
Sets the default topic prefix to be used when a subscription does not
specify a prefix to the specified 'prefix'.
|
void |
setKeepAliveEnabled(boolean isEnabled) |
void |
setMaxEventQueueSize(int eventQueueSize)
Sets the maximum number of outstanding un-delivered events per session
to the specified 'eventQueueSize'.
|
void |
setMaxPendingRequests(int pendingRequests)
Sets the maximum number of requests which can be pending (submitted but
have not received a final response (e.g
Event.EventType.RESPONSE
) to the specified 'maxPendingRequests'. |
void |
setMaxSendCacheSize(int writeCacheSize) |
void |
setNumStartAttempts(int numStartAttempts)
Sets the maximum number of attempts to start a session by connecting a
server.
|
void |
setRecordSubscriptionDataReceiveTimes(boolean shouldRecord)
Sets if the receipt time (accessed via
Message.timeReceivedMillis()) should be recorded for
subscription data messages. |
void |
setServerAddresses(SessionOptions.ServerAddress[] serverAddresses)
Sets the list of server address to the specified 'serverAddresses'.
|
void |
setServerHost(String serverHost)
Sets the API server host to connect to.
|
void |
setServerPort(int serverPort)
Set the port of the first element of the server list to the specified
'serverPort'.
|
void |
setServiceCheckTimeout(int timeoutMsecs)
Sets the timeout, in milliseconds, for identifying the version
information for the service schema when opening a new service.
|
void |
setServiceDownloadTimeout(int timeoutMsecs)
Sets the timeout, in milliseconds, for downloading the service schema
when opening a new service.
|
CorrelationID |
setSessionIdentityOptions(AuthOptions authOptions)
Sets the specified
authOptions as the AuthOptions for
the session identity with an automatically generated
CorrelationID. |
void |
setSessionIdentityOptions(AuthOptions authOptions,
CorrelationID correlationId)
Sets the specified
authOptions as the AuthOptions for
the session identity, enabling automatic authorization of the session
identity during startup. |
void |
setSlowConsumerWarningHiWaterMark(float slowConsumerWarningHiWaterMark)
Sets the point at which "slow consumer" events will be generated, using
the specified 'highWaterMark' as a fraction of 'maxEventQueueSize';
the default value is 0.75.
|
void |
setSlowConsumerWarningLoWaterMark(float slowConsumerWarningLoWaterMark)
Sets the point at which "slow consumer cleared" events will be
generated, using the specified 'loWaterMark' as a fraction of
'maxEventQueueSize';
the default value is 0.5.
|
void |
setTlsOptions(TlsOptions tlsOptions)
Sets the
TlsOptions used to configure secure communication with
endpoints. |
String |
toString() |
public SessionOptions()
serverHost = "127.0.0.1"
serverPort = 8194
maxSendCacheSize = 128MB
maxEventQueueSize =
maxPendingRequests = 1024
allowMultipeCorrelatorsPerMsg = false
slowConsumerWarningHiWaterMark = 0.75
slowConsumerWarningLoWaterMark = 0.50
defaultSubscriptionService = "//blp/mktdata"
defaultTopicPrefix = "/ticker/"
clientMode = SessionOptions.ClientMode.AUTO
keepAliveEnabled = true
TlsOptions = null // do not use TLS
public int getMaxEventQueueSize()
public int getMaxOutstandingRequests()
public int getMaxPendingRequests()
public String getServerHost()
public int getServerPort()
public SessionOptions.ServerAddress[] getServerAddresses()
public boolean getAutoRestartOnDisconnection()
true if configured to restart connection on
disconnection and false otherwise.public String authenticationOptions()
public int numStartAttempts()
public int getMaxSendCacheSize()
public boolean getAllowMultipleCorrelatorsPerMsg()
public float getSlowConsumerWarningHiWaterMark()
public float getSlowConsumerWarningLoWaterMark()
@Deprecated public String[] getDefaultServices()
getDefaultSubscriptionService()
insteadpublic String getDefaultSubscriptionService()
SubscriptionList for more information.public String getDefaultTopicPrefix()
SubscriptionList
for more information.public SessionOptions.ClientMode getClientMode()
public int getConnectTimeout()
public int getServiceCheckTimeout()
public int getServiceDownloadTimeout()
public int getDefaultKeepAliveInactivityTime()
public int getDefaultKeepAliveResponseTimeout()
public boolean getRecordSubscriptionDataReceiveTimes()
Message.timeReceivedMillis()) should be recorded for
subscription data messages.public TlsOptions getTlsOptions()
TlsOptions object if configured to use TLS and
null otherwise.public boolean getBandwidthSaveModeDisabled()
public void setMaxEventQueueSize(int eventQueueSize)
eventQueueSize - the value to be setpublic void setMaxPendingRequests(int pendingRequests)
Event.EventType.RESPONSE
) to the specified 'maxPendingRequests'. If the number of pending
requests exceeds the specified threshold, subsequent call to
Session.sendRequest(com.bloomberglp.blpapi.RequestTemplate, com.bloomberglp.blpapi.CorrelationID) will generate
RequestQueueOverflowException.
The default is 1024.pendingRequests - the value to be setpublic void setServerHost(String serverHost)
serverHost - the value to be setpublic void setServerPort(int serverPort)
serverPort - the value to be setpublic void setServerAddresses(SessionOptions.ServerAddress[] serverAddresses)
serverAddresses - the value to be setpublic void setAutoRestartOnDisconnection(boolean autoRestartOnDisconnection)
autoRestartOnDisconnection - the value to be setpublic void setAuthenticationOptions(String authOptions)
authOptions - the value to be setpublic void setMaxSendCacheSize(int writeCacheSize)
public void setAllowMultipleCorrelatorsPerMsg(boolean allowMultipleCorrelatorsPerMsg)
allowMultipleCorrelatorsPerMsg - the value to be setpublic void setSlowConsumerWarningHiWaterMark(float slowConsumerWarningHiWaterMark)
'0.0 < hiWaterMark <= 1.0'. Further, at the time that
'Session.start()' is called, it must be the case that
'slowConsumerWarningLoWaterMark() * maxEventQueueSize()' <
'slowConsumerWarningHiWaterMark() * maxEventQueueSize()'.slowConsumerWarningHiWaterMark - the value to be setpublic void setSlowConsumerWarningLoWaterMark(float slowConsumerWarningLoWaterMark)
'0.0 <= loWaterMark < 1.0'. Further, at the time that
'Session.start()' is called, it must be the case that
'slowConsumerWarningLoWaterMark() * maxEventQueueSize()' <
'slowConsumerWarningHiWaterMark() * maxEventQueueSize()'.slowConsumerWarningLoWaterMark - the value to be setpublic void setDefaultSubscriptionService(String defaultSubscriptionService)
^//[-_.a-zA-Z0-9]+/[-_.a-zA-Z0-9]+$.
The default is "//blp/mktdata".
For more information on when this will be used see 'QUALIFYING
SUBSCRIPTION STRINGS' section in SubscriptionList.defaultSubscriptionService - the value to be setpublic void setDefaultTopicPrefix(String defaultTopicPrefix)
SubscriptionList.defaultTopicPrefix - the value to be setpublic void setClientMode(SessionOptions.ClientMode clientMode)
SessionOptions.ClientMode.AUTO.
In SessionOptions.ClientMode.AUTO mode will try to connect to the desktop API
but fall back to the server API if the desktop is not available.
SessionOptions.ClientMode.DAPI always connects to the desktop API and will fail
if it is not available.
SessionOptions.ClientMode.SAPI always connects to the server API and will fail
if it is not available.clientMode - the value to be setpublic void setConnectTimeout(int timeoutMilliSeconds)
timeoutMilliSeconds - the value to be setpublic void setNumStartAttempts(int numStartAttempts)
numStartAttempts - the value to be setpublic void setDefaultKeepAliveInactivityTime(int inactivityMsecs)
inactivityMsecs - the value to be setpublic void setDefaultKeepAliveResponseTimeout(int timeoutMsecs)
timeoutMsecs - the value to be setpublic void setServiceCheckTimeout(int timeoutMsecs)
timeoutMsecs - the value to be set, in millisecondspublic void setServiceDownloadTimeout(int timeoutMsecs)
timeoutMsecs - the value to be set, in millisecondspublic void setKeepAliveEnabled(boolean isEnabled)
public void setRecordSubscriptionDataReceiveTimes(boolean shouldRecord)
Message.timeReceivedMillis()) should be recorded for
subscription data messages.public void setTlsOptions(TlsOptions tlsOptions)
TlsOptions used to configure secure communication with
endpoints.tlsOptions - the value to be set. Set null value to disable TLS.public void setBandwidthSaveModeDisabled(boolean isDisabled)
isDisabled - whether to disable bandwidth saving measures.public CorrelationID setSessionIdentityOptions(AuthOptions authOptions)
authOptions as the AuthOptions for
the session identity with an automatically generated
CorrelationID.authOptions - The AuthOptions to use for the session identity.CorrelationID that
identifies the messages associated with the session
identity.setSessionIdentityOptions(AuthOptions, CorrelationID)public void setSessionIdentityOptions(AuthOptions authOptions, CorrelationID correlationId)
authOptions as the AuthOptions for
the session identity, enabling automatic authorization of the session
identity during startup.
The session identity lifetime is tied to the session's lifetime, so it is guaranteed that the session identity will remain authorized during the entire duration of the session. The identity will be authorized before the session starts. The session will terminate if the identity fails to authorize or is revoked.
The session identity is used to send requests and make subscriptions if no other identity is provided.
By default the session identity is not authorized.
The behavior is undefined if either authOptions or
correlationId is null.
authOptions - The AuthOptions to use.correlationId - The CorrelationID to identify the
messages associated with the session identity.Copyright © 2021 Bloomberg L.P.. All rights reserved.