#include <OnixS/CME/ConflatedTCP/Session.h>
Public Member Functions | |
Session (const SessionSettings &settings, int marketSegmentId, SessionListener *sessionListener, MDP::MarketDataListener *marketDataListener, SessionStorageType::Enum storageType=SessionStorageType::FileBased, SessionStorage *storage=nullptr, UInt64 uuid=UndefinedUuid, const std::string &customKey="") | |
~Session () | |
UInt64 | uuid () const |
const std::string | id () const |
int | marketSegmentId () const |
const std::string | customKey () const |
Session & | connect (const std::string &host, Port port) |
Session & | disconnect (const std::string &reason="Terminate") |
template<typename SbeMessageType , size_t MaxMessageSize, typename MessageInitializer > | |
Session & | send (Messaging::MessageHolder< SbeMessageType, MaxMessageSize, MessageInitializer > &msg) |
template<typename SbeMessageType , size_t MaxMessageSize, typename MessageInitializer > | |
Session & | send (Messaging::MessageHolder< SbeMessageType, MaxMessageSize, MessageInitializer > &&msg) |
template<typename SbeMessageType , size_t MaxMessageSize, typename MessageInitializer > | |
Session & | send (Messaging::MessageHolders< SbeMessageType, MaxMessageSize, MessageInitializer > &msgs) |
template<typename SbeMessageType , size_t MaxMessageSize, typename MessageInitializer > | |
Session & | send (std::initializer_list< Messaging::MessageHolder< SbeMessageType, MaxMessageSize, MessageInitializer > > list) |
std::string | remoteHost () const |
std::string | remoteIpAddress () const |
Port | remotePort () const |
std::pair< Port, Port > | localPortRange () const |
Session & | localPortRange (std::pair< Port, Port > portRange) |
std::string | localNetworkInterface () const |
Session & | localNetworkInterface (const std::string &value) |
Port | localPort () const |
bool | tcpNoDelayOption () const |
Session & | tcpNoDelayOption (bool value) |
const SocketOptions & | socketOptions () const |
Session & | socketOptions (const SocketOptions &options) |
Session & | receivingThreadAffinity (CpuIndex cpuIndex) |
Session & | receivingThreadAffinity (const CpuIndexes &cpuIndexes) |
const CpuIndexes & | receivingThreadAffinity () const |
Session & | sendingThreadAffinity (CpuIndex cpuIndex) |
Session & | sendingThreadAffinity (const CpuIndexes &cpuIndexes) |
const CpuIndexes & | sendingThreadAffinity () const |
int | receivingThreadPriority () const |
Session & | receivingThreadPriority (int priority) |
int | sendingThreadPriority () const |
Session & | sendingThreadPriority (int priority) |
int | receivingThreadPolicy () const |
Session & | receivingThreadPolicy (int policy) |
int | sendingThreadPolicy () const |
Session & | sendingThreadPolicy (int policy) |
unsigned | receiveSpinningTimeout () const |
Session & | receiveSpinningTimeout (unsigned timeoutInUs) |
unsigned | sendSpinningTimeout () const |
Session & | sendSpinningTimeout (unsigned timeoutInUs) |
bool | reportNewMessagesWhileWaitingForMissedMessages () const |
Session & | reportNewMessagesWhileWaitingForMissedMessages (bool value) |
bool | validateSequenceNumbers () const |
Session & | validateSequenceNumbers (bool validate) |
unsigned | messageGrouping () const |
Session & | messageGrouping (unsigned numberOfMessagesToGroup) |
SessionStorageType::Enum | storageType () const |
const std::string & | storageId () const |
SeqNumber | outSeqNum () const |
Session & | outSeqNum (SeqNumber nextOutSeqNum) |
SeqNumber | inSeqNum () const |
Session & | inSeqNum (SeqNumber nextExpectedInSeqNum) |
SeqNumber | previousSeqNo () const |
Session & | previousSeqNo (SeqNumber value) |
Messaging::UInt64 | previousUuid () const |
Session & | previousUuid (Messaging::UInt64 value) |
Session & | reset (bool startOfWeek=false) |
SessionStateId::Enum | state () |
Messaging::Timestamp | creationTime () const |
void | flushSessionStorage () |
unsigned | reconnectAttempts () const |
Session & | reconnectAttempts (unsigned reconnectAttempts) |
unsigned | reconnectInterval () const |
Session & | reconnectInterval (unsigned seconds) |
bool | localTimeUsage () const |
Session & | localTimeUsage (bool useLocalTime) |
const std::string & | storageDirectory () const |
bool | logBeforeSending () const |
Session & | logBeforeSending (bool value) |
size_t | incomingMessageGapQueueMaximumSize () const |
Session & | incomingMessageGapQueueMaximumSize (size_t value) |
const Session & | log (const std::string &message) const |
std::string | toString () const |
Static Public Attributes | |
static const UInt64 | UndefinedUuid = 0 |
static const int | UndefinedAffinity = -1 |
Session | ( | const SessionSettings & | settings, |
int | marketSegmentId, | ||
SessionListener * | sessionListener, | ||
MDP::MarketDataListener * | marketDataListener, | ||
SessionStorageType::Enum | storageType = SessionStorageType::FileBased , |
||
SessionStorage * | storage = nullptr , |
||
UInt64 | uuid = UndefinedUuid , |
||
const std::string & | customKey = "" |
||
) |
Constructor.
settings | Session settings. |
marketSegmentId | Market segment ID. |
sessionListener | Session listener. |
marketDataListener | Market Data listener. |
storageType | Session storage type. |
storage | Session storage. |
uuid | Universally Unique Identifier (UUID). |
customKey | Custom key that could be used to distinguish sessions with the same UUID, Session ID, FirmId, and Market Segment ID values. |
~Session | ( | ) |
Establishes the connection.
host | Market Segment Gateway host. |
port | Market Segment Gateway port. |
Messaging::Timestamp creationTime | ( | ) | const |
const std::string customKey | ( | ) | const |
Session& disconnect | ( | const std::string & | reason = "Terminate" | ) |
Terminates the connection.
reason | Terminate reason details. |
void flushSessionStorage | ( | ) |
Flushes all internal buffers of the session storage.
const std::string id | ( | ) | const |
size_t incomingMessageGapQueueMaximumSize | ( | ) | const |
Session& incomingMessageGapQueueMaximumSize | ( | size_t | value | ) |
SeqNumber inSeqNum | ( | ) | const |
Sets the expected sequence number of the next inbound message.
std::string localNetworkInterface | ( | ) | const |
Session& localNetworkInterface | ( | const std::string & | value | ) |
Sets the IP Address or name of the local network interface.
Port localPort | ( | ) | const |
bool localTimeUsage | ( | ) | const |
Session& localTimeUsage | ( | bool | useLocalTime | ) |
Specifies the usage of local time in Handler events and logs files.
const Session& log | ( | const std::string & | message | ) | const |
Write the given user's message to the Handler's log file using the session formatted Id.
bool logBeforeSending | ( | ) | const |
true
if logging of an outgoing message to the session storage is performed before sending it to the wire, otherwise - false
. Session& logBeforeSending | ( | bool | value | ) |
Sets the option to log an outgoing message to the session storage before sending it to the wire.
int marketSegmentId | ( | ) | const |
unsigned messageGrouping | ( | ) | const |
Session& messageGrouping | ( | unsigned | numberOfMessagesToGroup | ) |
Sets the number of messages to be sent together.
numberOfMessagesToGroup | If the parameter is zero (by default) or one, the Handler tries to send an outgoing application-level message in the context of the thread that calls the OnixS::CME::ConflatedTCP::Session::send method. If the message cannot be sent immediately, it is stored in the queue for the subsequent sending by the sending thread. If this parameter is larger than one, the Handler stores outgoing SBE messages in the queue for the subsequent sending by the sending thread. |
SeqNumber outSeqNum | ( | ) | const |
Sets the sequence number of the next outgoing message.
SeqNumber previousSeqNo | ( | ) | const |
If no business message was published, the value is zero.
Sets the sequence number of the last business message published by CME with the PreviousUUID.
Messaging::UInt64 previousUuid | ( | ) | const |
Session& previousUuid | ( | Messaging::UInt64 | value | ) |
Sets the UUID from the previously Established session.
unsigned receiveSpinningTimeout | ( | ) | const |
Session& receiveSpinningTimeout | ( | unsigned | timeoutInUs | ) |
Sets the receive spinning timeout value (in microseconds).
Session& receivingThreadAffinity | ( | const CpuIndexes & | cpuIndexes | ) |
const CpuIndexes& receivingThreadAffinity | ( | ) | const |
Sets the receiving thread CPU affinity.
int receivingThreadPolicy | ( | ) | const |
Session& receivingThreadPolicy | ( | int | policy | ) |
Sets the receiving thread policy.
int receivingThreadPriority | ( | ) | const |
Session& receivingThreadPriority | ( | int | priority | ) |
Sets the scheduling priority of the receiving thread.
unsigned reconnectAttempts | ( | ) | const |
Session& reconnectAttempts | ( | unsigned | reconnectAttempts | ) |
Sets the maximum number of tries to restore the telecommunications link.
unsigned reconnectInterval | ( | ) | const |
Session& reconnectInterval | ( | unsigned | seconds | ) |
Sets the time interval between retries to restore the telecommunications link (seconds).
std::string remoteHost | ( | ) | const |
std::string remoteIpAddress | ( | ) | const |
Port remotePort | ( | ) | const |
bool reportNewMessagesWhileWaitingForMissedMessages | ( | ) | const |
true
if new messages are reported even when the message gap is detected, and the reply on the Retransmit Request message is expected, otherwise - false
. Session& reportNewMessagesWhileWaitingForMissedMessages | ( | bool | value | ) |
Sets the option to report new messages even when the message gap is detected, and the reply on the Retransmit Request message is expected.
Session& reset | ( | bool | startOfWeek = false | ) |
Backups the current log files, resets the sequence numbers to 1 and generates a new UUID.
startOfWeek | if true then the PreviousUUID and PreviousSeqNum are reset to 0. |
Session & send | ( | Messaging::MessageHolder< SbeMessageType, MaxMessageSize, MessageInitializer > & | msg | ) |
Session & send | ( | Messaging::MessageHolder< SbeMessageType, MaxMessageSize, MessageInitializer > && | msg | ) |
Session & send | ( | Messaging::MessageHolders< SbeMessageType, MaxMessageSize, MessageInitializer > & | msgs | ) |
Session & send | ( | std::initializer_list< Messaging::MessageHolder< SbeMessageType, MaxMessageSize, MessageInitializer > > | list | ) |
Session& sendingThreadAffinity | ( | const CpuIndexes & | cpuIndexes | ) |
Sets the sending thread CPU affinity.
const CpuIndexes& sendingThreadAffinity | ( | ) | const |
int sendingThreadPolicy | ( | ) | const |
Sets the sending thread policy.
Session& sendingThreadPolicy | ( | int | policy | ) |
int sendingThreadPriority | ( | ) | const |
Session& sendingThreadPriority | ( | int | priority | ) |
unsigned sendSpinningTimeout | ( | ) | const |
Session& sendSpinningTimeout | ( | unsigned | timeoutInUs | ) |
Sets the send spinning timeout value (in microseconds).
const SocketOptions& socketOptions | ( | ) | const |
Session& socketOptions | ( | const SocketOptions & | options | ) |
Sets socket options.
SessionStateId::Enum state | ( | ) |
const std::string& storageDirectory | ( | ) | const |
const std::string& storageId | ( | ) | const |
SessionStorageType::Enum storageType | ( | ) | const |
bool tcpNoDelayOption | ( | ) | const |
TCP_NODELAY
option (improve latency at the expense of message throughput). Session& tcpNoDelayOption | ( | bool | value | ) |
Sets the TCP_NODELAY
option (improve latency at the expense of message throughput).
std::string toString | ( | ) | const |
UInt64 uuid | ( | ) | const |
bool validateSequenceNumbers | ( | ) | const |
true
if incoming message sequence numbers are validated, otherwise - false
. Session& validateSequenceNumbers | ( | bool | validate | ) |
Turns on/off the validation of incoming message sequence numbers.