33 namespace ConflatedTCP
41 static const UInt64 UndefinedUuid = 0;
57 SessionStorage *storage = ONIXS_CONFLATEDTCP_NULLPTR,
UInt64 uuid = UndefinedUuid,
const std::string &customKey =
"" );
65 const std::string id()
const;
68 int marketSegmentId()
const;
71 const std::string customKey()
const;
81 Session& connect(
const std::string &host,
Port port);
92 Session& disconnect(
const std::string &reason =
"Terminate");
101 template <
typename SbeMessageType,
size_t MaxMessageSize,
typename MessageInitializer>
104 #if ONIXS_CONFLATEDTCP_COMPILER_CXX_RVALUE_REFERENCES 113 template <
typename SbeMessageType,
size_t MaxMessageSize,
typename MessageInitializer>
118 #if ONIXS_CONFLATEDTCP_COMPILER_CXX_ALIAS_TEMPLATES 127 template <
typename SbeMessageType,
size_t MaxMessageSize,
typename MessageInitializer>
132 #if defined(ONIXS_CONFLATEDTCP_CXX11) 141 template <
typename SbeMessageType,
size_t MaxMessageSize,
typename MessageInitializer>
155 template <
typename SbeMessageType,
size_t MaxMessageSize>
163 std::string remoteHost()
const;
166 std::string remoteIpAddress()
const;
169 Port remotePort()
const;
172 std::pair<Port, Port> localPortRange()
const;
175 Session& localPortRange(std::pair<Port, Port> portRange);
178 std::string localNetworkInterface()
const;
181 Session& localNetworkInterface(
const std::string &value);
184 Port localPort()
const;
187 bool tcpNoDelayOption()
const;
190 Session& tcpNoDelayOption(
bool value);
198 static const int UndefinedAffinity = -1;
207 const CpuIndexes &receivingThreadAffinity()
const;
216 const CpuIndexes &sendingThreadAffinity()
const;
219 int receivingThreadPriority()
const;
222 Session& receivingThreadPriority(
int priority);
225 int sendingThreadPriority()
const;
228 Session& sendingThreadPriority(
int priority);
231 int receivingThreadPolicy()
const;
234 Session& receivingThreadPolicy(
int policy);
237 int sendingThreadPolicy()
const;
240 Session& sendingThreadPolicy(
int policy);
243 unsigned receiveSpinningTimeout()
const;
246 Session& receiveSpinningTimeout(
unsigned timeoutInUs);
249 unsigned sendSpinningTimeout()
const;
252 Session& sendSpinningTimeout(
unsigned timeoutInUs);
257 bool reportNewMessagesWhileWaitingForMissedMessages()
const;
262 Session& reportNewMessagesWhileWaitingForMissedMessages(
bool value);
265 bool validateSequenceNumbers()
const;
268 Session& validateSequenceNumbers(
bool validate);
271 unsigned messageGrouping()
const;
283 Session& messageGrouping(
unsigned numberOfMessagesToGroup);
289 const std::string &storageId()
const;
333 Session& reset(
bool startOfWeek =
false);
342 void flushSessionStorage();
345 unsigned reconnectAttempts()
const;
348 Session& reconnectAttempts(
unsigned reconnectAttempts);
351 unsigned reconnectInterval()
const;
354 Session& reconnectInterval(
unsigned seconds);
357 bool localTimeUsage()
const;
360 Session& localTimeUsage(
bool useLocalTime);
363 const std::string &storageDirectory()
const;
366 bool logBeforeSending()
const;
369 Session& logBeforeSending(
bool value);
372 size_t incomingMessageGapQueueMaximumSize()
const;
375 Session& incomingMessageGapQueueMaximumSize(
size_t value);
378 const Session& log(
const std::string &message)
const;
381 std::string toString()
const;
388 void send(std::vector<Messaging::SbeMessage> msgs, std::vector<Messaging::SimpleOpenFramingHeader *> headers);
395 template <
typename SbeMessageType,
size_t MaxMessageSize,
typename MessageInitializer>
405 #if ONIXS_CONFLATEDTCP_COMPILER_CXX_RVALUE_REFERENCES 407 template <
typename SbeMessageType,
size_t MaxMessageSize,
typename MessageInitializer>
417 #if ONIXS_CONFLATEDTCP_COMPILER_CXX_ALIAS_TEMPLATES 419 template <
typename SbeMessageType,
size_t MaxMessageSize,
typename MessageInitializer>
422 std::vector<Messaging::SbeMessage> messages(msgs.size());
423 std::vector<Messaging::SimpleOpenFramingHeader *> headers(msgs.size());
425 for (
size_t i = 0; i < msgs.size(); ++i)
433 send(messages, headers);
440 #if defined(ONIXS_CONFLATEDTCP_CXX11) 442 template <
typename SbeMessageType,
size_t MaxMessageSize,
typename MessageInitializer>
446 return send(messages);
MessageType & message() noexcept
An Conflated TCP Session.
Messaging::UInt32 SeqNumber
Contains the SimpleOpenFramingHeader, the SBE message, and the data buffer.
#define ONIXS_CONFLATEDTCP_EXPORTED
File-based Session Storage.
Session & send(Messaging::MessageHolder< SbeMessageType, MaxMessageSize, MessageInitializer > &msg)
Sends the message.
std::vector< SocketOption > SocketOptions
Socket options.
std::set< CpuIndex > CpuIndexes
The time point without the time-zone information.
MessageSize setHeader() noexcept
Calculates the binary size of the message and updates the Simple Open Framing Header accordingly...
Session & warmUp(Messaging::MessageHolder< SbeMessageType, MaxMessageSize > &msg)
Warms up the sending path.
UInt16 MessageSize
Message length type.
Callbacks invoked by Handler during market data processing to reflect various stages of processing...
std::vector< MessageHolder< MessageTypeT, MaxMessageSize, MessageInitializer > > MessageHolders
const SimpleOpenFramingHeader * header() const noexcept