42 namespace AdHoc {
struct SessionHelper; };
50 static const UInt64 UndefinedSessionVerID = 0;
74 std::
string id() const;
80 std::
string customKey() const;
83 bool negotiated() const;
88 Session& negotiated(
bool negotiated);
106 Threading::SharedFuture<
void> connectAsync(const
std::
string & host,
Port port);
120 Threading::SharedFuture<
void> disconnectAsync();
132 template <typename SbeMessageType,
size_t MaxMessageSize, typename MessageInitializer>
134 Messaging::
MessageHolder<SbeMessageType, MaxMessageSize, MessageInitializer> &msg,
137 #if defined (ONIXS_B3_BOE_CXX11) 148 template <
typename SbeMessageType,
size_t MaxMessageSize,
typename MessageInitializer>
156 static const size_t B3BOEMaxPacketSize = 1420;
158 #if defined (ONIXS_B3_BOE_CXX11) 175 template <
typename SbeMessageType,
size_t MaxMessageSize,
typename MessageInitializer>
179 size_t maxPacketSize = B3BOEMaxPacketSize);
199 size_t maxPacketSize = B3BOEMaxPacketSize);
212 Session& sendSequenceMessage();
225 template <
typename SbeMessageType,
size_t MaxMessageSize>
229 int warmupFlags = 0);
232 #if defined (ONIXS_B3_BOE_CXX11) 249 template <
typename SbeMessageType,
size_t MaxMessageSize,
typename MessageInitializer>
253 size_t maxPacketSize = B3BOEMaxPacketSize,
254 int warmupFlags = 0);
273 size_t maxPacketSize = B3BOEMaxPacketSize,
int warmupFlags = 0);
290 size_t tryThrottle();
300 Session & throttlingLimit(
size_t messagesCount,
size_t intervalInMs = 1000);
303 std::string remoteHost()
const;
306 std::string remoteIpAddress()
const;
309 Port remotePort()
const;
312 std::pair<Port, Port> localPortRange() const ONIXS_B3_BOE_NOTHROW;
318 std::
string localNetworkInterface() const;
321 Session& localNetworkInterface(const
std::
string &value);
324 Port localPort() const;
327 bool tcpNoDelayOption() const;
330 Session& tcpNoDelayOption(
bool value);
338 static const
int UndefinedAffinity = -1;
347 const
CpuIndexes &receivingThreadAffinity() const;
356 const
CpuIndexes &sendingThreadAffinity() const;
359 int receivingThreadPriority() const;
362 Session& receivingThreadPriority(
int priority);
365 int sendingThreadPriority() const;
368 Session& sendingThreadPriority(
int priority);
371 int receivingThreadPolicy() const;
374 Session& receivingThreadPolicy(
int policy);
377 int sendingThreadPolicy() const;
380 Session& sendingThreadPolicy(
int policy);
383 unsigned receiveSpinningTimeout() const ONIXS_B3_BOE_NOTHROW;
386 Session& receiveSpinningTimeout(
unsigned timeoutInUs);
389 unsigned sendSpinningTimeout() const ONIXS_B3_BOE_NOTHROW;
392 Session& sendSpinningTimeout(
unsigned timeoutInUs);
396 bool reportNewMessagesWhileWaitingForMissedMessages() const;
400 Session& reportNewMessagesWhileWaitingForMissedMessages(
bool value);
403 unsigned messageGrouping() const ONIXS_B3_BOE_NOTHROW;
415 Session& messageGrouping(
unsigned numberOfMessagesToGroup);
421 const
std::
string &storageId() const ONIXS_B3_BOE_NOTHROW;
424 SeqNumber outSeqNum() const ONIXS_B3_BOE_NOTHROW;
448 Messaging::
Timestamp creationTime() const ONIXS_B3_BOE_NOTHROW;
451 void flushSessionStorage();
454 unsigned reconnectAttempts() const;
457 Session& reconnectAttempts(
unsigned reconnectAttempts);
460 unsigned reconnectInterval() const;
463 Session& reconnectInterval(
unsigned seconds);
466 bool localTimeUsage() const;
469 Session& localTimeUsage(
bool useLocalTime);
472 const
std::
string &storageDirectory() const;
475 bool logBeforeSending() const;
478 Session& logBeforeSending(
bool value);
481 size_t incomingMessageGapQueueMaximumSize() const;
484 Session& incomingMessageGapQueueMaximumSize(
size_t value);
487 const
Session& log(const
std::
string &message) const;
490 std::
string toString() const;
493 Messaging::
Timestamp licenseExpirationDate() const;
496 Messaging::
SchemaVersion messagingVersion() const ONIXS_B3_BOE_NOTHROW;
507 size_t outboundQueueBytes();
517 static const
std::
string& version() ONIXS_B3_BOE_NOTHROW;
521 Session& operator=(const Session& );
528 template <typename SbeMessageType,
size_t MaxMessageSize, typename MessageInitializer>
529 void validate(const Messaging::
MessageHolder<SbeMessageType, MaxMessageSize, MessageInitializer> &msg) const;
531 void validateVersion(Messaging::
SchemaVersion version) const;
538 friend struct AdHoc::SessionHelper;
541 template <typename SbeMessageType,
size_t MaxMessageSize, typename MessageInitializer>
543 Session& Session::send(Messaging::
MessageHolder<SbeMessageType, MaxMessageSize, MessageInitializer> &msg, Messaging::
Timestamp ts)
551 send(msg.toNetworkMessage(), ts);
556 template <
typename SbeMessageType,
size_t MaxMessageSize>
568 #if defined (ONIXS_B3_BOE_CXX11) 570 template <
typename SbeMessageType,
size_t MaxMessageSize,
typename MessageInitializer>
582 #if defined (ONIXS_B3_BOE_CXX11) 584 template <
typename SbeMessageType,
size_t MaxMessageSize,
typename MessageInitializer>
589 size_t maxPacketSize)
593 send(msgs.netMsgs_, maxPacketSize, ts);
597 template <
typename SbeMessageType,
size_t MaxMessageSize,
typename MessageInitializer>
605 warmUp(msgs.netMsgs_, maxPacketSize, flags, ts);
611 template <
typename SbeMessageType,
size_t MaxMessageSize,
typename MessageInitializer>
614 validateVersion(holder->version());
The time point without the time-zone information.
Session & send(Messaging::MessageHolder< SbeMessageType, MaxMessageSize, MessageInitializer > &msg, Messaging::Timestamp sendingTime=UtcWatch::now())
Sends the message.
#define ONIXS_B3_BOE_NULLPTR
Contains the SimpleOpenFramingHeader, the SBE message, and the data buffer.
MessageHeader::Version SchemaVersion
SBE-encoded data version type.
#define ONIXS_B3_BOE_NOTHROW
#define ONIXS_B3_BOE_HOTPATH
The message batch wrapper.
#define ONIXS_B3_BOE_EXPORTED
UInt32 SessionID
Client connection identification on the gateway assigned by B3.
File-based Session Storage.
std::vector< NetworkMessage > NetMessages
Session's network stack reactor interface.
std::set< CpuIndex > CpuIndexes
Messaging::UInt32 SeqNumber
Session & warmUp(Messaging::MessageHolder< SbeMessageType, MaxMessageSize > &msg, Messaging::Timestamp sendingTime=UtcWatch::now(), int warmupFlags=0)
Warms up the sending path.
std::vector< SocketOption > SocketOptions
Socket options.
int Handle
Type alias for socket handle.
NetworkMessage toNetworkMessage() noexcept
The class can be used to combine messages with different types to the batch for sending.