42namespace AdHoc {
struct SessionHelper; };
77 std::
string id() const;
156 template <typename SbeMessageType,
size_t MaxMessageSize, typename MessageInitializer>
161#if defined (ONIXS_ILINK3_CXX11)
172 template <
typename SbeMessageType,
size_t MaxMessageSize,
typename MessageInitializer>
182#if defined (ONIXS_ILINK3_CXX11)
199 template <
typename SbeMessageType,
size_t MaxMessageSize,
typename MessageInitializer>
251 template <
typename SbeMessageType,
size_t MaxMessageSize>
255 int warmupFlags = 0);
258#if defined (ONIXS_ILINK3_CXX11)
275 template <
typename SbeMessageType,
size_t MaxMessageSize,
typename MessageInitializer>
280 int warmupFlags = 0);
585 template <typename SbeMessageType,
size_t MaxMessageSize, typename MessageInitializer>
586 void validate(const
Messaging::
MessageHolder<SbeMessageType, MaxMessageSize, MessageInitializer> &msg) const;
635 static const
int marketSegmentId_ = INT_MAX;
638template <typename SbeMessageType,
size_t MaxMessageSize, typename MessageInitializer>
648 send(msg.toNetworkMessage(), ts);
653template <
typename SbeMessageType,
size_t MaxMessageSize>
665#if defined (ONIXS_ILINK3_CXX11)
667template <
typename SbeMessageType,
size_t MaxMessageSize,
typename MessageInitializer>
679#if defined (ONIXS_ILINK3_CXX11)
681template <
typename SbeMessageType,
size_t MaxMessageSize,
typename MessageInitializer>
686 size_t maxPacketSize)
690 send(msgs.netMsgs_, maxPacketSize, ts);
694template <
typename SbeMessageType,
size_t MaxMessageSize,
typename MessageInitializer>
702 warmUp(msgs.netMsgs_, maxPacketSize, flags, ts);
708template <
typename SbeMessageType,
size_t MaxMessageSize,
typename MessageInitializer>
712 validateVersion(holder->version());
#define ONIXS_ILINK3_HOTPATH
#define ONIXS_ILINK3_NULLPTR
#define ONIXS_ILINK3_EXPORTED
#define ONIXS_ILINK3_NOTHROW
CgwSession(SessionReactor &stack, const SessionSettings &settings, SessionListener *listener, SessionStorageType::Enum storageType=SessionStorageType::FileBased, SessionStorage *storage=nullptr, UInt64 uuid=UndefinedUuid, const std::string &customKey="")
Constructor.
CgwSession(const SessionSettings &settings, SessionListener *listener, SessionStorageType::Enum storageType=SessionStorageType::FileBased, SessionStorage *storage=nullptr, UInt64 uuid=UndefinedUuid, const std::string &customKey="")
Constructor.
The class can be used to combine messages with different types to the batch for sending.
The message batch wrapper.
Contains the SimpleOpenFramingHeader, the SBE message, and the data buffer.
NetworkMessage toNetworkMessage() noexcept
A network iLink3 message.
The time point without the time-zone information.
Session's network stack reactor interface.
static const UInt64 UndefinedUuid
bool localTimeUsage() const
Messaging::Timestamp licenseExpirationDate() const
unsigned messageGrouping() const noexcept
std::string localNetworkInterface() const
std::string customKey() const
static const std::string & version() noexcept
Threading::SharedFuture< void > breakConnectionAsync()
Breaks the connection non-gracefully asynchronously.
friend struct AdHoc::SessionHelper
static const int UndefinedAffinity
static const size_t CmeMaxPacketSize
CME states: Packet size maximum behavior based on MTU (Maximum Transmission Unit) - 1420 bytes,...
std::string remoteIpAddress() const
Session & throttle()
Performs the throttling of a session that must be called before each send function call.
Session(SessionReactor &stack, const SessionSettings &settings, int marketSegmentId, SessionListener *listener, SessionStorageType::Enum storageType=SessionStorageType::FileBased, SessionStorage *storage=nullptr, UInt64 uuid=UndefinedUuid, const std::string &customKey="")
std::string toString() const
Session & breakConnection()
Breaks the connection non-gracefully.
std::string remoteHost() const
const SocketOptions & socketOptions() const
unsigned reconnectAttempts() const
bool reportNewMessagesWhileWaitingForMissedMessages() const
Session & throttlingLimit(size_t messagesCount, size_t intervalInMs=1000)
Sets throttling limit parameters.
Messaging::FTI::Enum faultToleranceIndicator() const
SeqNumber outSeqNum() const noexcept
Messaging::SchemaVersion messagingVersion() const noexcept
std::pair< Port, Port > localPortRange() const noexcept
const std::string & storageDirectory() const
int receivingThreadPolicy() const
size_t incomingMessageGapQueueMaximumSize() const
bool getTcpInfo(TcpInfo &)
Gets information about the underlying TCP connection.
bool detectMessageGapForPreviousUuid() const
Session & sendSequenceMessage(Messaging::KeepAliveLapsed::Enum keepAliveLapsed=Messaging::KeepAliveLapsed::Lapsed)
Send the Sequence message.
unsigned receiveSpinningTimeout() const noexcept
Session & warmUp(Messaging::MessageHolder< SbeMessageType, MaxMessageSize > &msg, Messaging::Timestamp sendingTime=UtcWatch::now(), int warmupFlags=0)
Warms up the sending path.
Handle socketHandle()
Returns the socket handle which the session uses to transmit data.
Session & receivingThreadAffinity(CpuIndex cpuIndex)
Sets the receiving thread CPU affinity.
int marketSegmentId() const noexcept
unsigned reconnectInterval() const
SessionStorageType::Enum storageType() const noexcept
Messaging::UInt64 previousUuid() const noexcept
int sendingThreadPriority() const
UInt64 uuid() const noexcept
size_t outboundQueueBytes()
Returns the total number of bytes in the outbound queue.
const std::string & storageId() const noexcept
Session & send(MessageBatchCombiner &msgs, Messaging::Timestamp sendingTime=UtcWatch::now(), size_t maxPacketSize=CmeMaxPacketSize)
Sends messages.
size_t tryThrottle()
Checks the throttling of a session that must be called before each send function call.
static const Handle InvalidSocketHandle
Represents invalid value of socket handle.
bool logBeforeSending() const
Session & disconnect(const std::string &reason="")
Terminates the connection.
Messaging::Timestamp creationTime() const noexcept
Session & reset(bool startOfWeek=false)
Backups the current log files, resets the sequence numbers to 1 and generates a new UUID.
SessionStateId::Enum state() const
void flushSessionStorage()
Flushes all internal buffers of the session storage.
SeqNumber inSeqNum() const
Session & send(Messaging::MessageHolder< SbeMessageType, MaxMessageSize, MessageInitializer > &msg, Messaging::Timestamp sendingTime=UtcWatch::now())
Sends the message.
int receivingThreadPriority() const
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.
Session & sendingThreadAffinity(CpuIndex cpuIndex)
Sets the sending thread CPU affinity.
Session & connect(const std::string &host, Port port)
Establishes the connection.
SeqNumber previousSeqNo() const noexcept
Session & warmUp(MessageBatchCombiner &msgs, Messaging::Timestamp sendingTime=UtcWatch::now(), size_t maxPacketSize=CmeMaxPacketSize, int warmupFlags=0)
Warms up the sending path.
unsigned sendSpinningTimeout() const noexcept
Session(const SessionSettings &settings, int marketSegmentId, SessionListener *listener, SessionStorageType::Enum storageType=SessionStorageType::FileBased, SessionStorage *storage=nullptr, UInt64 uuid=UndefinedUuid, const std::string &customKey="")
Constructor.
int sendingThreadPolicy() const
Sets the sending thread policy.
Threading::SharedFuture< void > disconnectAsync(const std::string &reason="")
Terminates the connection asynchronously.
bool tcpNoDelayOption() const
Threading::SharedFuture< void > connectAsync(const std::string &host, Port port)
Establishes the connection asynchronously.
A high-level wrapper over the TCPDirect network stack.
void validate(const Message &)
MessageHeader::Version SchemaVersion
SBE-encoded data version type.
std::vector< NetworkMessage > NetMessages
std::vector< SocketOption > SocketOptions
Socket options.
int Handle
Type alias for socket handle.
std::set< CpuIndex > CpuIndexes
Messaging::UInt32 SeqNumber
@ FileBased
File-based Session Storage.