38namespace AdHoc {
struct SessionHelper; };
85 std::string
id()
const;
149 template <
typename SbeMessageType,
size_t MaxMessageSize,
typename MessageInitializer>
163 template <
typename SbeMessageType,
size_t MaxMessageSize,
typename MessageInitializer>
185 template <
typename SbeMessageType,
size_t MaxMessageSize,
typename MessageInitializer>
272 template <
typename SbeMessageType,
size_t MaxMessageSize>
276 int warmupFlags = 0);
294 template <
typename SbeMessageType,
size_t MaxMessageSize,
typename MessageInitializer>
299 int warmupFlags = 0);
338 size_t maxPacketSize =
MaxPacketSize,
int warmupFlags = 0) ONIXS_ICEBOE_NONULL;
614 template <typename SbeMessageType,
size_t MaxMessageSize, typename MessageInitializer>
615 void validate(const
Messaging::
MessageHolder<SbeMessageType, MaxMessageSize, MessageInitializer> &msg) const;
627template <typename SbeMessageType,
size_t MaxMessageSize, typename MessageInitializer>
637 send(msg.toNetworkMessage(), ts);
642template <
typename SbeMessageType,
size_t MaxMessageSize>
653template <
typename SbeMessageType,
size_t MaxMessageSize,
typename MessageInitializer>
663template <
typename SbeMessageType,
size_t MaxMessageSize,
typename MessageInitializer>
668 size_t maxPacketSize)
672 if ONIXS_ICEBOE_UNLIKELY(msgs.netMsgs_.empty())
678 send(begin, end, maxPacketSize, ts);
682template <
typename SbeMessageType,
size_t MaxMessageSize,
typename MessageInitializer>
690 if ONIXS_ICEBOE_UNLIKELY(msgs.netMsgs_.empty())
696 warmUp(begin, end, maxPacketSize, flags, ts);
700template <
typename SbeMessageType,
size_t MaxMessageSize,
typename MessageInitializer>
704 validateVersion(holder->version());
#define ONIXS_ICEBOE_NAMESPACE_BEGIN
#define ONIXS_ICEBOE_NAMESPACE_END
#define ONIXS_ICEBOE_HOTPATH
#define ONIXS_ICEBOE_EXPORTED
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
The time point without the time-zone information.
Session's network stack reactor interface.
Session(SessionReactor &stack, SessionType::Enum sessionType, const SessionSettings &settings, SessionListener *listener, SessionStorageType::Enum storageType=SessionStorageType::FileBased, SessionStorage *storage=nullptr, const std::string &customKey={})
bool localTimeUsage() const
Messaging::Timestamp licenseExpirationDate() const
unsigned messageGrouping() const noexcept
std::string localNetworkInterface() const
std::string customKey() const
Threading::SharedFuture< void > breakConnectionAsync()
Breaks the connection non-gracefully asynchronously.
friend struct AdHoc::SessionHelper
static const int UndefinedAffinity
std::string remoteIpAddress() const
Session & throttle()
Performs the throttling of a session that must be called before each send function call.
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.
Session & warmUp(NetworkMessage *begin, NetworkMessage *end, Messaging::Timestamp sendingTime=UtcWatch::now(), size_t maxPacketSize=MaxPacketSize, int warmupFlags=0) ONIXS_ICEBOE_NONULL
Warms up the sending path.
SeqNumber outSeqNum() const noexcept
Messaging::SchemaVersion messagingVersion() const noexcept
Session & send(MessageBatchCombiner &msgs, Messaging::Timestamp sendingTime=UtcWatch::now(), size_t maxPacketSize=MaxPacketSize)
Sends messages.
std::pair< Port, Port > localPortRange() const noexcept
Session & send(NetworkMessage *begin, NetworkMessage *end, Messaging::Timestamp sendingTime=UtcWatch::now(), size_t maxPacketSize=MaxPacketSize) ONIXS_ICEBOE_NONULL
Sends messages.
static const size_t MaxPacketSize
const std::string & storageDirectory() const
int receivingThreadPolicy() const
size_t incomingMessageGapQueueMaximumSize() const
bool getTcpInfo(TcpInfo &)
Gets information about the underlying TCP connection.
unsigned receiveSpinningTimeout() const noexcept
Session & warmUp(Messaging::MessageHolder< SbeMessageType, MaxMessageSize > &msg, Messaging::Timestamp sendingTime=UtcWatch::now(), int warmupFlags=0)
Warms up the sending path.
Session & warmUp(MessageBatchCombiner &msgs, Messaging::Timestamp sendingTime=UtcWatch::now(), size_t maxPacketSize=MaxPacketSize, int warmupFlags=0)
Warms up the sending path.
Handle socketHandle()
Returns the socket handle which the session uses to transmit data.
Session & send(NetMessagesRange range, Messaging::Timestamp sendingTime=UtcWatch::now(), size_t maxPacketSize=MaxPacketSize)
Sends messages.
Session & receivingThreadAffinity(CpuIndex cpuIndex)
Sets the receiving thread CPU affinity.
Threading::SharedFuture< void > disconnectAsync(const std::string &reason={})
Terminates the connection asynchronously.
unsigned reconnectInterval() const
SessionStorageType::Enum storageType() const noexcept
int sendingThreadPriority() const
size_t outboundQueueBytes()
Returns the total number of bytes in the outbound queue.
Session(SessionType::Enum sessionType, const SessionSettings &settings, SessionListener *listener, SessionStorageType::Enum storageType=SessionStorageType::FileBased, SessionStorage *storage=nullptr, const std::string &customKey={})
Constructor.
const std::string & storageId() const noexcept
int clientId() const noexcept
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 & sendSequenceMessage()
Send the Sequence message.
Session & disconnect(const std::string &reason={})
Terminates the connection.
Messaging::Timestamp creationTime() const noexcept
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.
static const char * version() noexcept
Session & reset()
Backups the current log files, resets the sequence numbers to 1.
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.
unsigned sendSpinningTimeout() const noexcept
int sendingThreadPolicy() const
Sets the sending thread policy.
bool tcpNoDelayOption() const
Threading::SharedFuture< void > connectAsync(const std::string &host, Port port)
Establishes the connection asynchronously.
Represents a future result of an asynchronous operation - a result that will eventually appear in the...
void validate(const Message &)
MessageHeader::Version SchemaVersion
SBE-encoded data version type.
std::pair< NetworkMessage *, NetworkMessage * > NetMessagesRange
std::vector< SocketOption > SocketOptions
Socket options.
int Handle
Type alias for socket handle.
std::ostream & operator<<(std::ostream &o, SessionType::Enum type)
std::set< CpuIndex > CpuIndexes
Messaging::UInt32 SeqNumber
@ FileBased
File-based Session Storage.
@ BUS
Binary Utility Service Gateway.
@ BGW
Binary Order Gateway.
static const std::string toString(Enum state)