Public Types | Public Member Functions

blpapi::SessionOptions Class Reference

#include <blpapi_sessionoptions.h>

List of all members.

Public Types

enum  ClientMode { AUTO = BLPAPI_CLIENTMODE_AUTO, DAPI = BLPAPI_CLIENTMODE_DAPI, SAPI = BLPAPI_CLIENTMODE_SAPI }

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 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)
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)
const char * serverHost () const
unsigned short serverPort () const
size_t numServerAddresses () const
int getServerAddress (const char **serverHost, unsigned short *serverPort, 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
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.


Member Enumeration Documentation

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

blpapi::SessionOptions::SessionOptions (  ) 

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

blpapi::SessionOptions::SessionOptions ( const SessionOptions original  ) 

Copy constructor

blpapi::SessionOptions::~SessionOptions (  ) 

Destroy this SessionOptions.


Member Function Documentation

SessionOptions& blpapi::SessionOptions::operator= ( const SessionOptions rhs  ) 

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

void blpapi::SessionOptions::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.

void blpapi::SessionOptions::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.

int blpapi::SessionOptions::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.

int blpapi::SessionOptions::removeServerAddress ( size_t  index  ) 

Remove the server address at the specified index.

void blpapi::SessionOptions::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

void blpapi::SessionOptions::setDefaultServices ( const char *  defaultServices  ) 

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

void blpapi::SessionOptions::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.

void blpapi::SessionOptions::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.

void blpapi::SessionOptions::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.

void blpapi::SessionOptions::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.

void blpapi::SessionOptions::setMaxPendingRequests ( int  maxPendingRequests  ) 

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

void blpapi::SessionOptions::setAuthenticationOptions ( const char *  authOptions  ) 

Set the specified authOptions as authentication option.

void blpapi::SessionOptions::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 one.

void blpapi::SessionOptions::setAutoRestartOnDisconnection ( bool  autoRestart  ) 

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

void blpapi::SessionOptions::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.

void blpapi::SessionOptions::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().

void blpapi::SessionOptions::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().

void blpapi::SessionOptions::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.

void blpapi::SessionOptions::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.

void blpapi::SessionOptions::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.

void blpapi::SessionOptions::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.

void blpapi::SessionOptions::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 60,000 milliseconds.

void blpapi::SessionOptions::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.

void blpapi::SessionOptions::setTlsOptions ( const TlsOptions tlsOptions  ) 

Set the TLS options to the specified tlsOptions.

void blpapi::SessionOptions::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.

const char* blpapi::SessionOptions::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.

unsigned short blpapi::SessionOptions::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.

size_t blpapi::SessionOptions::numServerAddresses (  )  const

Return the number of server addresses.

int blpapi::SessionOptions::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.

unsigned int blpapi::SessionOptions::connectTimeout (  )  const

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

const char* blpapi::SessionOptions::defaultServices (  )  const

Return all default services in one string.

const char* blpapi::SessionOptions::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.

const char* blpapi::SessionOptions::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.

bool blpapi::SessionOptions::allowMultipleCorrelatorsPerMsg (  )  const

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

int blpapi::SessionOptions::clientMode (  )  const

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

int blpapi::SessionOptions::maxPendingRequests (  )  const

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

blpapi_SessionOptions_t* blpapi::SessionOptions::handle (  )  const

Return the handle of the current session options.

bool blpapi::SessionOptions::autoRestartOnDisconnection (  )  const

Return whether automatically restarting connection if disconnected.

const char* blpapi::SessionOptions::authenticationOptions (  )  const

Return authentication options in a string.

int blpapi::SessionOptions::numStartAttempts (  )  const

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

size_t blpapi::SessionOptions::maxEventQueueSize (  )  const

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

float blpapi::SessionOptions::slowConsumerWarningHiWaterMark (  )  const

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

float blpapi::SessionOptions::slowConsumerWarningLoWaterMark (  )  const

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

int blpapi::SessionOptions::defaultKeepAliveInactivityTime (  )  const

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

int blpapi::SessionOptions::defaultKeepAliveResponseTimeout (  )  const

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

bool blpapi::SessionOptions::keepAliveEnabled (  )  const

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

bool blpapi::SessionOptions::recordSubscriptionDataReceiveTimes (  )  const

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

int blpapi::SessionOptions::serviceCheckTimeout (  )  const

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

int blpapi::SessionOptions::serviceDownloadTimeout (  )  const

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

int blpapi::SessionOptions::flushPublishedEventsTimeout (  )  const

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

std::ostream& blpapi::SessionOptions::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).


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