com.bloomberglp.blpapi
Class SessionOptions

java.lang.Object
  extended by com.bloomberglp.blpapi.SessionOptions

public final class SessionOptions
extends java.lang.Object

To use non-default options on a Session, create a SessionOptions instance and set the required options and then supply it when creating a Session.

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.
 


Nested Class Summary
static class SessionOptions.ClientMode
          Enumerations describing client mode of Session

static class SessionOptions.ServerAddress
           
 
Constructor Summary
SessionOptions()
          Construct a SessionOption with well defined defaults for various options Currently the following defaults are applied
 
Method Summary
 java.lang.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.
 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.
 java.lang.String[] getDefaultServices()
          Deprecated. as of 3.7.0, use getDefaultSubscriptionService() instead
 java.lang.String getDefaultSubscriptionService()
          Returns the default subscription service option.
 java.lang.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.
 java.lang.String getServerHost()
          Returns the value of the server host option in this instance.
 int getServerPort()
          Returns the server port that this session connects to.
 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.
 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(java.lang.String authOptions)
          Sets the specified 'authOptions' as authentication option.
 void setAutoRestartOnDisconnection(boolean autoRestartOnDisconnection)
          Sets option of automatically restarting connection if disconnected.
 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(java.lang.String defaultSubscriptionService)
          Sets the default service for subscriptions which do not specify a subscription server to the specified 'serviceIdentifier'.
 void setDefaultTopicPrefix(java.lang.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(java.lang.String serverHost)
          Sets the API server host to connect to.
 void setServerPort(int serverPort)
          Set the port to connect to the specified 'port'.
 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.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SessionOptions

public SessionOptions()
Construct a SessionOption with well defined defaults for various options Currently the following defaults are applied
     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
 

Method Detail

getMaxEventQueueSize

public int getMaxEventQueueSize()
Returns the value of maximum outstanding undelivered events that the session is configured with.

Returns:
maximum outstanding event configuration

getMaxOutstandingRequests

public int getMaxOutstandingRequests()
Returns the value of maximum outstanding requests that the session is configured with.

Returns:
maximum outstanding request configuration

getMaxPendingRequests

public int getMaxPendingRequests()
Returns the value of the maximum pending request option in this instance.

Returns:
maximum pending request

getServerHost

public java.lang.String getServerHost()
Returns the value of the server host option in this instance.

Returns:
server host

getServerPort

public int getServerPort()
Returns the server port that this session connects to. If more than one server addresses are specified, return the port of the first server address.

Returns:
server port

getServerAddresses

public SessionOptions.ServerAddress[] getServerAddresses()
Returns the list of server addresses that this session is configured to connect to.

Returns:
list of server addresses

getAutoRestartOnDisconnection

public boolean getAutoRestartOnDisconnection()
Returns if enabled to automatically restart connection on disconnection.

Returns:
true if configured to restart connection on disconnection and false otherwise.

authenticationOptions

public java.lang.String authenticationOptions()
Returns authentication options as a string.

Returns:
authentication options

numStartAttempts

public 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.

Returns:
maximum start attempts

getMaxSendCacheSize

public int getMaxSendCacheSize()

getAllowMultipleCorrelatorsPerMsg

public boolean getAllowMultipleCorrelatorsPerMsg()
Returns the value of the allow multiple correlators per message option in this instance.

Returns:
allow multiple correlators per message option

getSlowConsumerWarningHiWaterMark

public float getSlowConsumerWarningHiWaterMark()
Returns the fraction of maxEventQueueSize at which "slow consumer" event will be generated.

Returns:
slow consumer high watermark option

getSlowConsumerWarningLoWaterMark

public float getSlowConsumerWarningLoWaterMark()
Returns the fraction of maxEventQueueSize at which "slow consumer cleared" event will be generated.

Returns:
slow consumer low watermark option

getDefaultServices

public java.lang.String[] getDefaultServices()
Deprecated. as of 3.7.0, use getDefaultSubscriptionService() instead


getDefaultSubscriptionService

public java.lang.String getDefaultSubscriptionService()
Returns the default subscription service option. See SubscriptionList for more information.

Returns:
default subscription service option

getDefaultTopicPrefix

public java.lang.String getDefaultTopicPrefix()
Returns the default topic prefix option. See SubscriptionList for more information.

Returns:

getClientMode

public SessionOptions.ClientMode getClientMode()
Returns the value of the client mode option in this instance.

Returns:
client mode option

getConnectTimeout

public int getConnectTimeout()
Returns the value of the connection timeout option in this instance in milliseconds.

Returns:
the connection timeout option

getDefaultKeepAliveInactivityTime

public int getDefaultKeepAliveInactivityTime()
Returns the interval (in milliseconds) a connection has to remain inactive (receive no data) before a keep alive probe will be sent.

Returns:
the default keep alive inactivity time interval option

getDefaultKeepAliveResponseTimeout

public int getDefaultKeepAliveResponseTimeout()
Returns the time (in milliseconds) the library will wait for response to a keep alive probe before declaring it lost.

Returns:
the default keep alive response timeout option

getRecordSubscriptionDataReceiveTimes

public boolean getRecordSubscriptionDataReceiveTimes()
Returns if the receipt time (accessed via Message.timeReceivedMillis()) should be recorded for subscription data messages.


setMaxEventQueueSize

public void setMaxEventQueueSize(int eventQueueSize)
Sets the maximum number of outstanding un-delivered events per session to the specified 'eventQueueSize'. All subsequent events delivered over the network will be dropped by the session if the number of outstanding un-delivered events is 'eventQueueSize', the specified threshold. The default value is 10000.

Parameters:
eventQueueSize - the value to be set

setMaxPendingRequests

public 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'. If the number of pending requests exceeds the specified threshold, subsequent call to Session.sendRequest(com.bloomberglp.blpapi.Request, com.bloomberglp.blpapi.CorrelationID) will generate RequestQueueOverflowException. The default is 1024.

Parameters:
pendingRequests - the value to be set

setServerHost

public void setServerHost(java.lang.String serverHost)
Sets the API server host to connect to. The specified 'host' should be a hostname or an IPv4 address (that is, a.b.c.d). The default is "127.0.0.1".

Parameters:
serverHost - the value to be set

setServerPort

public void setServerPort(int serverPort)
Set the port to connect to the specified 'port'. The default is 8194.

Parameters:
serverPort - the value to be set

setServerAddresses

public void setServerAddresses(SessionOptions.ServerAddress[] serverAddresses)
Sets the list of server address to the specified 'serverAddresses'.

Parameters:
serverAddresses - the value to be set

setAutoRestartOnDisconnection

public void setAutoRestartOnDisconnection(boolean autoRestartOnDisconnection)
Sets option of automatically restarting connection if disconnected.

Parameters:
autoRestartOnDisconnection - the value to be set

setAuthenticationOptions

public void setAuthenticationOptions(java.lang.String authOptions)
Sets the specified 'authOptions' as authentication option.

Parameters:
authOptions - the value to be set

setMaxSendCacheSize

public void setMaxSendCacheSize(int writeCacheSize)

setAllowMultipleCorrelatorsPerMsg

public void setAllowMultipleCorrelatorsPerMsg(boolean allowMultipleCorrelatorsPerMsg)
Sets whether the Session is allowed to associate more than one CorrelationId with a Message to the specified 'allowMultipleCorrelatorsPerMsg'. The default is 'false'. This means that if you have multiple subscriptions which overlap (that is a particular Message is relevant to all of them) you will be presented with the same message multiple times when you use the MessageIterator, each time with a different CorrelationId. If you specify 'true' for this then a Message may be presented with multiple CorrelationId's.

Parameters:
allowMultipleCorrelatorsPerMsg - the value to be set

setSlowConsumerWarningHiWaterMark

public 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. A warning event will be generated when the number of outstanding un-delivered events passes above 'hiWaterMark * maxEventQueueSize'. The behavior of the function is undefined unless '0.0 < hiWaterMark <= 1.0'. Further, at the time that 'Session.start()' is called, it must be the case that 'slowConsumerWarningLoWaterMark() * maxEventQueueSize()' < 'slowConsumerWarningHiWaterMark() * maxEventQueueSize()'.

Parameters:
slowConsumerWarningHiWaterMark - the value to be set

setSlowConsumerWarningLoWaterMark

public 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. A warning cleared event will be generated when the number of outstanding un-delivered events drops below 'loWaterMark * maxEventQueueSize'. The behavior of the function is undefined unless '0.0 <= loWaterMark < 1.0'. Further, at the time that 'Session.start()' is called, it must be the case that 'slowConsumerWarningLoWaterMark() * maxEventQueueSize()' < 'slowConsumerWarningHiWaterMark() * maxEventQueueSize()'.

Parameters:
slowConsumerWarningLoWaterMark - the value to be set

setDefaultSubscriptionService

public void setDefaultSubscriptionService(java.lang.String defaultSubscriptionService)
Sets the default service for subscriptions which do not specify a subscription server to the specified 'serviceIdentifier'. The behavior is undefined unless 'serviceIdentifier' matches the regular expression ^//[-_.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.

Parameters:
defaultSubscriptionService - the value to be set

setDefaultTopicPrefix

public void setDefaultTopicPrefix(java.lang.String defaultTopicPrefix)
Sets the default topic prefix to be used when a subscription does not specify a prefix to the specified 'prefix'. The default is "/ticker/". For more information on when this will be used see 'QUALIFYING SUBSCRIPTION STRINGS' section in SubscriptionList.

Parameters:
defaultTopicPrefix - the value to be set

setClientMode

public void setClientMode(SessionOptions.ClientMode clientMode)
Sets how to connect to the API. The default is 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.

Parameters:
clientMode - the value to be set

setConnectTimeout

public void setConnectTimeout(int timeoutMilliSeconds)
Sets the connection timeout in milliseconds when connecting to the API. The default is 5000 milliseconds. Behavior is not defined unless the specified 'timeoutMilliSeconds' is in range of [1 .. 120000] milliseconds.

Parameters:
timeoutMilliSeconds - the value to be set

setNumStartAttempts

public void setNumStartAttempts(int numStartAttempts)
Sets the maximum number of attempts to start a session by connecting a server.

Parameters:
numStartAttempts - the value to be set

setDefaultKeepAliveInactivityTime

public 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. If 'inactivityMsecs == 0', then no keep-alive pings will be sent. The behavior of this function is undefined unless 'inactivityMsecs' is a non-negative value. The default value is 20,000 milliseconds. Note that not all back-end connections provide ping-based keep-alives; this option is ignored by such connections.

Parameters:
interval - the value to be set

setDefaultKeepAliveResponseTimeout

public void setDefaultKeepAliveResponseTimeout(int timeoutMsecs)
Sets the default keep live response timeout interval in milliseconds. When a keep-alive ping is sent, wait for the specified 'timeoutMsecs' to receive traffic (of any kind) before terminating the connection due to inactivity. If 'timeoutMsecs == 0', then connections are never terminated due to the absence of traffic after a keep-alive ping. The behavior of this function is undefined unless 'timeoutMsecs' is a non-negative value. The default value is 5,000 milliseconds. Note that not all back-end connections provide support for ping-based keep-alives; this option is ignored by such connections.

Parameters:
timeout - the value to be set

setKeepAliveEnabled

public void setKeepAliveEnabled(boolean isEnabled)

setRecordSubscriptionDataReceiveTimes

public void setRecordSubscriptionDataReceiveTimes(boolean shouldRecord)
Sets if the receipt time (accessed via Message.timeReceivedMillis()) should be recorded for subscription data messages.



Copyright © 2015 Bloomberg L.P.. All Rights Reserved.