BLPAPI C++  3.24.8
SessionOptions Class Reference

#include <blpapi_sessionoptions.h>

Public Types

enum  ClientMode {
  AUTO = 0,
  DAPI = 1,
  SAPI = 2
}
 

Public Member Functions

 SessionOptions ()
 
 SessionOptions (const SessionOptions &original)
 
 ~SessionOptions ()
 
SessionOptionsoperator= (const SessionOptions &rhs)
 
void setServerHost (const char *host)
 
void setServerPort (unsigned short port)
 
int setServerAddress (const char *serverHost, unsigned short serverPort, size_t index)
 
int setServerAddress (const char *serverHost, unsigned short serverPort, const Socks5Config &socks5Config, size_t index)
 
int removeServerAddress (size_t index)
 
void setConnectTimeout (unsigned int timeoutMilliSeconds)
 
void setDefaultServices (const char *defaultServices)
 
void setDefaultSubscriptionService (const char *serviceIdentifier)
 
void setDefaultTopicPrefix (const char *prefix)
 
void setAllowMultipleCorrelatorsPerMsg (bool allowMultipleCorrelatorsPerMsg)
 
void setClientMode (int clientMode)
 
void setMaxPendingRequests (int maxPendingRequests)
 
CorrelationId setSessionIdentityOptions (const AuthOptions &authOptions, const CorrelationId &correlationId=CorrelationId())
 
void setAuthenticationOptions (const char *authOptions)
 
void setNumStartAttempts (int numStartAttempts)
 
void setAutoRestartOnDisconnection (bool autoRestart)
 
void setMaxEventQueueSize (size_t eventQueueSize)
 
void setSlowConsumerWarningHiWaterMark (float hiWaterMark)
 
void setSlowConsumerWarningLoWaterMark (float loWaterMark)
 
void setDefaultKeepAliveInactivityTime (int inactivityMsecs)
 
void setDefaultKeepAliveResponseTimeout (int timeoutMsecs)
 
void setKeepAliveEnabled (bool isEnabled)
 
void setRecordSubscriptionDataReceiveTimes (bool shouldRecord)
 
void setServiceCheckTimeout (int timeoutMsecs)
 
void setServiceDownloadTimeout (int timeoutMsecs)
 
void setTlsOptions (const TlsOptions &tlsOptions)
 
void setFlushPublishedEventsTimeout (int timeoutMsecs)
 
void setBandwidthSaveModeDisabled (bool isDisabled)
 
void setApplicationIdentityKey (const std::string &applicationIdentityKey)
 
void setSessionName (const std::string &sessionName)
 
const char * serverHost () const
 
unsigned short serverPort () const
 
size_t numServerAddresses () const
 
int getServerAddress (const char **serverHost, unsigned short *serverPort, size_t index) const
 
int getServerAddress (const char **serverHost, unsigned short *serverPort, Socks5Config *socksConfig, size_t index) const
 
unsigned int connectTimeout () const
 
const char * defaultServices () const
 
const char * defaultSubscriptionService () const
 
const char * defaultTopicPrefix () const
 
bool allowMultipleCorrelatorsPerMsg () const
 
int clientMode () const
 
int maxPendingRequests () const
 
blpapi_SessionOptions_thandle () const
 
bool autoRestartOnDisconnection () const
 
const char * authenticationOptions () const
 
int numStartAttempts () const
 
size_t maxEventQueueSize () const
 
float slowConsumerWarningHiWaterMark () const
 
float slowConsumerWarningLoWaterMark () const
 
int defaultKeepAliveInactivityTime () const
 
int defaultKeepAliveResponseTimeout () const
 
bool keepAliveEnabled () const
 
bool recordSubscriptionDataReceiveTimes () const
 
int serviceCheckTimeout () const
 
int serviceDownloadTimeout () const
 
int flushPublishedEventsTimeout () const
 
bool bandwidthSaveModeDisabled () const
 
std::string applicationIdentityKey ()
 
std::string sessionName ()
 
std::ostream & print (std::ostream &stream, int indentLevel=0, int spacesPerLevel=4) const
 

Detailed Description

Contains the options which the user can specify when creating a session.

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.

See Component blpapi_sessionoptions

Member Enumeration Documentation

◆ ClientMode

enum ClientMode
Enumerator
AUTO 

Automatic (desktop if available otherwise server)

DAPI 

Always connect to the desktop API.

SAPI 

Always connect to the server API.

Constructor & Destructor Documentation

◆ SessionOptions() [1/2]

Create a SessionOptions with all options set to the standard defaults.

◆ SessionOptions() [2/2]

SessionOptions ( const SessionOptions original)

Copy constructor

◆ ~SessionOptions()

Destroy this SessionOptions.

Member Function Documentation

◆ allowMultipleCorrelatorsPerMsg()

bool allowMultipleCorrelatorsPerMsg ( ) const

Return the value of the allow multiple correlators per message option in this SessionOptions instance.

◆ applicationIdentityKey()

std::string applicationIdentityKey ( )

Return the application identity key (AIK) which uniquely identifies this application for this session.

◆ authenticationOptions()

const char * authenticationOptions ( ) const

Return authentication options in a string.

◆ autoRestartOnDisconnection()

bool autoRestartOnDisconnection ( ) const

Return whether automatically restarting connection if disconnected.

◆ bandwidthSaveModeDisabled()

bool bandwidthSaveModeDisabled ( ) const

Return true if bandwidth saving measures have been disabled; otherwise return false.

◆ clientMode()

int clientMode ( ) const

Return the value of the client mode option in this SessionOptions instance.

◆ connectTimeout()

unsigned int connectTimeout ( ) const

Return the value of the connection timeout option in this SessionOptions instance in milliseconds.

◆ defaultKeepAliveInactivityTime()

int defaultKeepAliveInactivityTime ( ) const

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

◆ defaultKeepAliveResponseTimeout()

int defaultKeepAliveResponseTimeout ( ) const

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

◆ defaultServices()

const char * defaultServices ( ) const

Return all default services in one string.

◆ defaultSubscriptionService()

const char * defaultSubscriptionService ( ) const

Return a pointer to the value of the default subscription service option in this SessionOptions instance. The pointer is valid until this SessionOptions is destroyed or setDefaultSubscriptionService() is called.

◆ defaultTopicPrefix()

const char * defaultTopicPrefix ( ) const

Return a pointer to the value of the default topic prefix option in this SessionOptions instance. The pointer is valid until this SessionOptions is destroyed or setDefaultTopicPrefix() is called.

◆ flushPublishedEventsTimeout()

int flushPublishedEventsTimeout ( ) const

Return the timeout, in milliseconds, for ProviderSession to flush published events before stopping. The default value is 2000.

◆ getServerAddress() [1/2]

int getServerAddress ( const char **  serverHost,
unsigned short *  serverPort,
size_t  index 
) const

Put the server name and port into serverHost and serverPort indexed by index. Return 0 if succeeded; otherwise, return non-zero.

◆ getServerAddress() [2/2]

int getServerAddress ( const char **  serverHost,
unsigned short *  serverPort,
Socks5Config socksConfig,
size_t  index 
) const

Put the server name and port into serverHost, serverPort, and associated socksConfig indexed by index. Return 0 if succeeded; otherwise, return non-zero. Behavior is undefined if serverHost, serverPort, or socksConfig is nullptr.

◆ handle()

blpapi_SessionOptions_t * handle ( ) const

Return the handle of the current session options.

◆ keepAliveEnabled()

bool keepAliveEnabled ( ) const

Return true if the keep-alive mechanism is enabled; otherwise return false.

◆ maxEventQueueSize()

size_t maxEventQueueSize ( ) const

Return the value of maximum outstanding undelivered events that the session is configured with.

◆ maxPendingRequests()

int maxPendingRequests ( ) const

Return the value of the maximum pending request option in this SessionOptions instance.

◆ numServerAddresses()

size_t numServerAddresses ( ) const

Return the number of server addresses.

◆ numStartAttempts()

int numStartAttempts ( ) const

Return the maximum number of attempts to start a session by connecting a server.

◆ operator=()

SessionOptions & operator= ( const SessionOptions rhs)

Assign to this object the value of the specified rhs object.

◆ print()

std::ostream & print ( std::ostream &  stream,
int  indentLevel = 0,
int  spacesPerLevel = 4 
) const

Format this SessionOptions to the specified output stream at the (absolute value of) the optionally specified indentation level and return a reference to stream. If level is specified, optionally specify spacesPerLevel, the number of spaces per indentation level for this and all of its nested objects. If level is negative, suppress indentation of the first line. If spacesPerLevel is negative, format the entire output on one line, suppressing all but the initial indentation (as governed by level).

◆ recordSubscriptionDataReceiveTimes()

bool recordSubscriptionDataReceiveTimes ( ) const

Return whether the receipt time (accessed via blpapi::Message::timeReceived) should be recorded for subscription data messages.

◆ removeServerAddress()

int removeServerAddress ( size_t  index)

Remove the server address at the specified index.

◆ serverHost()

const char * serverHost ( ) const

Return a pointer to the value of the server host option in this SessionOptions instance. The pointer is valid until this SessionOptions is destroyed setServerHost() is called.

◆ serverPort()

unsigned short serverPort ( ) const

Return the server port that this session connects to. If more than one server addresses are specified, return the port of the first server address.

◆ serviceCheckTimeout()

int serviceCheckTimeout ( ) const

Return the value of the service check timeout option in this SessionOptions instance in milliseconds.

◆ serviceDownloadTimeout()

int serviceDownloadTimeout ( ) const

Return the value of the service download timeout option in this SessionOptions instance in milliseconds.

◆ sessionName()

std::string sessionName ( )

Return the session name.

◆ setAllowMultipleCorrelatorsPerMsg()

void setAllowMultipleCorrelatorsPerMsg ( bool  allowMultipleCorrelatorsPerMsg)

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

◆ setApplicationIdentityKey()

void setApplicationIdentityKey ( const std::string &  applicationIdentityKey)

Set the application identity key (AIK) which uniquely identifies this application for this session.

◆ setAuthenticationOptions()

void setAuthenticationOptions ( const char *  authOptions)

Set the specified authOptions as authentication option.

◆ setAutoRestartOnDisconnection()

void setAutoRestartOnDisconnection ( bool  autoRestart)

Set whether to automatically retry connecting if the connection to a server gets disconnected. The default is true. The number of times such a retry is attempted is controlled by numStartAttempts.

◆ setBandwidthSaveModeDisabled()

void setBandwidthSaveModeDisabled ( bool  isDisabled)

If the specified isDisabled is true, then disable bandwidth saving measures. The default value is false.

◆ setClientMode()

void setClientMode ( int  clientMode)

Set how to connect to the API. The default is AUTO which will try to connect to the desktop API but fall back to the server API if the desktop is not available. DAPI always connects to the desktop API and will fail if it is not available. SAPI always connects to the server API and will fail if it is not available.

◆ setConnectTimeout()

void setConnectTimeout ( unsigned int  timeoutMilliSeconds)

Set 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

◆ setDefaultKeepAliveInactivityTime()

void setDefaultKeepAliveInactivityTime ( int  inactivityMsecs)

Set to the specified inactivityMsecs the amount of time 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.

◆ setDefaultKeepAliveResponseTimeout()

void setDefaultKeepAliveResponseTimeout ( int  timeoutMsecs)

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.

◆ setDefaultServices()

void setDefaultServices ( const char *  defaultServices)

DEPRECATED

Set the default service for the session. This function is deprecated; see setDefaultSubscriptionService.

◆ setDefaultSubscriptionService()

void setDefaultSubscriptionService ( const char *  serviceIdentifier)

Set 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 blpapi_subscriptionlist.

◆ setDefaultTopicPrefix()

void setDefaultTopicPrefix ( const char *  prefix)

Set 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 blpapi_subscriptionlist.

◆ setFlushPublishedEventsTimeout()

void setFlushPublishedEventsTimeout ( int  timeoutMsecs)

Set the timeout, in milliseconds, for ProviderSession to flush published events before stopping. The behavior is not defined unless the specified timeoutMsecs is a positive value. The default value is 2000.

◆ setKeepAliveEnabled()

void setKeepAliveEnabled ( bool  isEnabled)

If the specified isEnabled is false, then disable all keep-alive mechanisms, both from the client to the server and from the server to the client; otherwise enable keep-alive pings both from the client to the server (as configured by setDefaultKeepAliveInactivityTime and setDefaultKeepAliveResponseTimeout if the connection supports ping-based keep-alives), and from the server to the client as specified by the server configuration.

◆ setMaxEventQueueSize()

void setMaxEventQueueSize ( size_t  eventQueueSize)

Set the maximum number of outstanding undelivered 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 undelivered events is eventQueueSize, the specified threshold. The default value is 10000.

◆ setMaxPendingRequests()

void setMaxPendingRequests ( int  maxPendingRequests)

Set the maximum number of requests which can be pending to the specified maxPendingRequests. The default is 1024.

◆ setNumStartAttempts()

void setNumStartAttempts ( int  numStartAttempts)

Set the maximum number of attempts to connect to a server. This option only has effect when autoRestartOnDisconnection is set to true. The default is 3.

◆ setRecordSubscriptionDataReceiveTimes()

void setRecordSubscriptionDataReceiveTimes ( bool  shouldRecord)

Set whether the receipt time (accessed via blpapi::Message::timeReceived) should be recorded for subscription data messages. By default, the receipt time for these messages is not recorded.

◆ setServerAddress() [1/2]

int setServerAddress ( const char *  serverHost,
unsigned short  serverPort,
size_t  index 
)

Set the server address at the specified index in the server list using the specified serverHost and serverPort. The default is "127.0.0.1:8194". Behavior is undefined if the specified serverHost is a nullptr or points to an empty string.

◆ setServerAddress() [2/2]

int setServerAddress ( const char *  serverHost,
unsigned short  serverPort,
const Socks5Config socks5Config,
size_t  index 
)

Set the server address at the specified index in the server list using the specified serverHost, serverPort, and socks5Config.

Behavior is undefined if the specified serverHost is a nullptr or points to an empty string.

◆ setServerHost()

void setServerHost ( const char *  host)

Set the API server host to connect to when using the server API to the specified host, which is a hostname or an IPv4 address (that is, a.b.c.d). This will update only the first element in the server list. The default is "127.0.0.1". Behavior is undefined if the specified host is a nullptr or points to an empty string.

◆ setServerPort()

void setServerPort ( unsigned short  port)

Set the port to connect to when using the server API to the specified port. This will update only the first element of the server list. The default port is 8194.

◆ setServiceCheckTimeout()

void setServiceCheckTimeout ( int  timeoutMsecs)

Set the timeout, in milliseconds, when opening a service for checking what version of the schema should be downloaded. The behavior is not defined unless timeoutMsecs is a positive value. The default timeout is 120,000 milliseconds.

◆ setServiceDownloadTimeout()

void setServiceDownloadTimeout ( int  timeoutMsecs)

Set the timeout, in milliseconds, when opening a service for downloading the service schema. The behavior is not defined unless the specified timeoutMsecs is a positive value. The default timeout is 120,000 milliseconds.

◆ setSessionIdentityOptions()

CorrelationId setSessionIdentityOptions ( const AuthOptions authOptions,
const CorrelationId correlationId = CorrelationId() 
)

Set the specified authOptions as the AuthOptions for the session identity, enabling automatic authorization of the session identity during startup. The optionally specified correlationId is used to identify the messages associated with the session identity.

Return the actual CorrelationId that identifies the messages associated with the session identity.

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.

◆ setSessionName()

void setSessionName ( const std::string &  sessionName)

Set the session name which can be used to identify the log lines pertaining to the session. The length of the session name should be short, and never exceed 100 characters. be short, and never exceed 100 characters. Session names cannot have embedded NUL (\0) characters.

◆ setSlowConsumerWarningHiWaterMark()

void setSlowConsumerWarningHiWaterMark ( float  hiWaterMark)

Set 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 undelivered 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().

◆ setSlowConsumerWarningLoWaterMark()

void setSlowConsumerWarningLoWaterMark ( float  loWaterMark)

Set 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 undelivered 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().

◆ setTlsOptions()

void setTlsOptions ( const TlsOptions tlsOptions)

Set the TLS options to the specified tlsOptions.

◆ slowConsumerWarningHiWaterMark()

float slowConsumerWarningHiWaterMark ( ) const

Return the fraction of maxEventQueueSize at which "slow consumer" event will be generated.

◆ slowConsumerWarningLoWaterMark()

float slowConsumerWarningLoWaterMark ( ) const

Return the fraction of maxEventQueueSize at which "slow consumer cleared" event will be generated.


The documentation for this class was generated from the following file: