OnixS C++ ICE Binary Order Entry Handler 1.0.0
API Documentation
Loading...
Searching...
No Matches
SessionSettings.h
Go to the documentation of this file.
1/*
2 * Copyright Onix Solutions Limited [OnixS]. All rights reserved.
3 *
4 * This software owned by Onix Solutions Limited [OnixS] and is protected by copyright law
5 * and international copyright treaties.
6 *
7 * Access to and use of the software is governed by the terms of the applicable OnixS Software
8 * Services Agreement (the Agreement) and Customer end user license agreements granting
9 * a non-assignable, non-transferable and non-exclusive license to use the software
10 * for it's own data processing purposes under the terms defined in the Agreement.
11 *
12 * Except as otherwise granted within the terms of the Agreement, copying or reproduction of any part
13 * of this source code or associated reference material to any other location for further reproduction
14 * or redistribution, and any amendments to this copyright notice, are expressly prohibited.
15 *
16 * Any reproduction or redistribution for sale or hiring of the Software not in accordance with
17 * the terms of the Agreement is a violation of copyright law.
18 */
19
20#pragma once
21
22#include <OnixS/ICE/BOE/ABI.h>
26
27#include <climits>
28#include <set>
29#include <string>
30#include <vector>
31
33
38{
39public:
42
47 const std::string & userId() const noexcept
48 {
49 return userId_;
50 }
51
54 SessionSettings& userId(const std::string & value);
55
60 Messaging::Int32 clientId() const noexcept
61 {
62 return clientId_;
63 }
64
68
73 const std::string& rawData() const noexcept
74 {
75 return rawData_;
76 }
77
80 SessionSettings& rawData(const std::string& value);
81
86 const std::string & ipSessionToken() const noexcept
87 {
88 return ipSessionToken_;
89 }
90
93 SessionSettings& ipSessionToken(const std::string & value);
94
100 {
101 return threadingModel_;
102 }
103
107
112 unsigned receiveSpinningTimeout() const noexcept
113 {
114 return receiveSpinningTimeout_;
115 }
116
120
125 unsigned sendSpinningTimeout() const noexcept
126 {
127 return sendSpinningTimeout_;
128 }
129
132 SessionSettings& sendSpinningTimeout(unsigned usecTimeout);
133
142 unsigned messageGrouping() const noexcept
143 {
144 return messageGrouping_;
145 }
146
150
153
156 SessionSettings& addLicenseStore(const std::string& value);
157
160 SessionSettings& licenseStore(const std::string & value);
161
163 typedef std::vector<std::string> LicenseStores;
164
169 const LicenseStores& licenseStores() const noexcept
170 {
171 return licenseStores_;
172 }
173
178 unsigned licenseAlertingDaysBeforeExpiration() const noexcept
179 {
180 return licenseAlertingDaysBeforeExpiration_;
181 }
182
191 {
192 licenseAlertingDaysBeforeExpiration_ = days;
193 return *this;
194 }
195
200 const std::string & localNetworkInterface() const noexcept
201 {
202 return localNetworkInterface_;
203 }
204
210 SessionSettings& localNetworkInterface(const std::string & value);
211
216 const std::string & logFileName() const noexcept
217 {
218 return logFileName_;
219 }
220
223 SessionSettings& logFileName(const std::string & value);
224
231 const std::string & storageDirectory() const noexcept
232 {
233 return storageDirectory_;
234 }
235
240 SessionSettings& storageDirectory(const std::string & value);
241
246 bool localTimeUsage() const noexcept
247 {
248 return localTimeUsage_;
249 }
250
256
262 {
263 return fileBasedStorageSegmentSize_;
264 }
265
269
274 unsigned asyncFileBasedStorageQueueMaxSize() const noexcept
275 {
276 return asyncFileBasedStorageQueueMaxSize_;
277 }
278
282
288 {
289 return asyncFileBasedStorageThreadAffinity_;
290 }
291
295
304 {
305 return ignoreFileBasedStorageIntegrityErrors_;
306 }
307
311
316 bool logBeforeSending() const noexcept
317 {
318 return logBeforeSending_;
319 }
320
326
331 unsigned reconnectAttempts() const noexcept
332 {
333 return reconnectAttempts_;
334 }
335
339
344 unsigned reconnectInterval() const noexcept
345 {
346 return reconnectInterval_;
347 }
348
353
355 static const int UseOsDefaultSocketBufferSize = -1;
356
361 int socketReceiveBufferSize() const noexcept
362 {
363 return socketReceiveBufferSize_;
364 }
365
372
377 unsigned reasonableTransmissionTime() const noexcept
378 {
379 return reasonableTransmissionTime_;
380 }
381
385
390 int socketSendBufferSize() const noexcept
391 {
392 return socketSendBufferSize_;
393 }
394
401
404 const CpuIndexes & threadPoolAffinity() const noexcept
405 {
406 return threadPoolAffinity_;
407 }
408
412
415 int threadPoolPriority() const noexcept
416 {
417 return threadPoolPriority_;
418 }
419
423
426 int threadPoolPolicy() const noexcept
427 {
428 return threadPoolPolicy_;
429 }
430
434
439 bool tcpNoDelayOption() const noexcept
440 {
441 return tcpNoDelayOption_;
442 }
443
447
452 unsigned threadPoolSize() const noexcept
453 {
454 return threadPoolSize_;
455 }
456
459 SessionSettings& threadPoolSize(unsigned numberOfThreads);
460
465 unsigned short keepAliveInterval() const noexcept
466 {
467 return keepAliveInterval_;
468 }
469
475 SessionSettings& keepAliveInterval(unsigned short seconds);
476
484 {
485 return reportNewMessagesWhileWaitingForMissedMessages_;
486 }
487
493
497
500 PortRange localPortRange() const noexcept
501 {
502 return localPortRange_;
503 }
504
510
514 {
515 return messagingSchemaVersion_;
516 }
517
522 bool useSpinLock() const noexcept
523 {
524 return useSpinLock_;
525 }
526
530
535 bool enableRxTimestamp() const noexcept
536 {
537 return enableRxTimestamp_;
538 }
539
544
549 bool useTLS() const noexcept
550 {
551 return useTLS_;
552 }
553
557
562 LogLevel::Enum logLevel() const noexcept
563 {
564 return logLevel_;
565 }
566
570
576 {
577 return loggerOptions_;
578 }
579
583
588 SessionSettings& load(const std::string& configFile);
589
592 std::string toString() const;
593
596 {
598 static const bool CreateLogFile = true;
599 static const unsigned short KeepAliveInterval = 30;
600 static const bool LogBeforeSending = true;
603 static const bool TcpNoDelayOption = true;
604 static const int ReceiveSpinningTimeout = 0;
605 static const int SendSpinningTimeout = 0;
606 static const char LicenseStore[];
607 static const unsigned LicenseAlertingDaysBeforeExpiration = 0;
608 static const char LogDir[];
609 static const char LogFileName[];
610 static const bool LocalTimeUsage = false;
611 static const unsigned MessageGrouping = 0;
612 static const int ReasonableTransmissionTime = 20;
613 static const int ReconnectAttempts = 3;
614 static const int ReconnectInterval = 180;
615 static const unsigned long long FileBasedStorageSegmentSize = 0;
616 static const bool IgnoreFileBasedStorageIntegrityErrors = false;
617 static const int ThreadPoolSize = 0;
619 static const unsigned AsyncFileBasedStorageQueueMaxSize = UINT_MAX;
620 static const bool UseSpinLock = false;
621 static const bool EnableRxTimestamp = false;
622 static const bool UseTLS = false;
625 };
626
629 {
630 static const char * UserId;
631 static const char * ClientId;
632 static const char * RawData;
635 static const char * ThreadingModel;
636 static const char * TcpNoDelayOption;
637 static const char * MessageGrouping;
638 static const char * FileBasedStorageSegmentSize;
640 static const char * KeepAliveInterval;
641 static const char * LicenseStore;
643 static const char * LocalNetworkInterface;
644 static const char * LogFileName;
645 static const char * LocalTimeUsage;
646 static const char * LogBeforeSending;
647 static const char * ReasonableTransmissionTime;
648 static const char * ReceiveSpinningTimeout;
649 static const char * ReconnectAttempts;
650 static const char * ReconnectInterval;
651 static const char * SendSpinningTimeout;
652 static const char * ThreadPoolAffinity;
653 static const char * ThreadPoolSize;
654 static const char * ThreadPoolPriority;
655 static const char * ThreadPoolPolicy;
656 static const char * SocketReceiveBufferSize;
657 static const char * SocketSendBufferSize;
658 static const char * StorageDirectory;
660 static const char * MessagingSchemaVersion;
661 static const char * LocalPortRange;
662 static const char * UseSpinLock;
663 static const char * EnableRxTimestamp;
664 static const char * UseTLS;
665 static const char * LogSeverity;
666 static const char * LoggerOptions;
667 };
668
669private:
670 void processLicenseStores(const std::string& licenseStore);
671
672 std::string ipSessionToken_;
673
674 unsigned asyncFileBasedStorageQueueMaxSize_;
675
676 CpuIndexes asyncFileBasedStorageThreadAffinity_;
677
678 bool createEngineLogFile_;
679
680 Messaging::UInt64 fileBasedStorageSegmentSize_;
681
682 Messaging::Int32 clientId_;
683
684 bool ignoreFileBasedStorageIntegrityErrors_;
685
686 unsigned short keepAliveInterval_;
687
688 unsigned licenseAlertingDaysBeforeExpiration_;
689
690 LicenseStores licenseStores_;
691
692 std::string localNetworkInterface_;
693
694 bool localTimeUsage_;
695
696 bool logBeforeSending_;
697
698 std::string logFileName_;
699
700 unsigned messageGrouping_;
701
702 unsigned reasonableTransmissionTime_;
703
704 int receiveSpinningTimeout_;
705
706 unsigned reconnectAttempts_;
707
708 unsigned reconnectInterval_;
709
710 bool reportNewMessagesWhileWaitingForMissedMessages_;
711
712 std::string rawData_;
713
714 int sendSpinningTimeout_;
715
716 std::string userId_;
717
718 int socketReceiveBufferSize_;
719
720 int socketSendBufferSize_;
721
722 std::string storageDirectory_;
723
724 bool tcpNoDelayOption_;
725
726 ThreadingModel::Enum threadingModel_;
727
728 CpuIndexes threadPoolAffinity_;
729
730 int threadPoolPolicy_;
731
732 int threadPoolPriority_;
733
734 unsigned threadPoolSize_;
735
736 std::pair<Port, Port> localPortRange_;
737
738 Messaging::SchemaVersion messagingSchemaVersion_;
739
740 bool useSpinLock_;
741
742 bool enableRxTimestamp_;
743
744 bool useTLS_;
745
746 LogLevel::Enum logLevel_;
747
748 LogSettings::Enum loggerOptions_;
749};
750
#define ONIXS_ICEBOE_NAMESPACE_BEGIN
Definition ABI.h:94
#define ONIXS_ICEBOE_NAMESPACE_END
Definition ABI.h:98
#define ONIXS_ICEBOE_EXPORTED
Definition Compiler.h:153
#define ONIXS_ICEBOE_NODISCARD
Definition Compiler.h:154
int socketSendBufferSize() const noexcept
LogLevel::Enum logLevel() const noexcept
The default value is LogLevel::Info.
unsigned messageGrouping() const noexcept
SessionSettings & threadPoolSize(unsigned numberOfThreads)
Sets the size of the shared thread pool.
Messaging::Int32 clientId() const noexcept
const std::string & userId() const noexcept
unsigned licenseAlertingDaysBeforeExpiration() const noexcept
SessionSettings & resetToDefaults()
Resets the settings to the default values.
const CpuIndexes & asyncFileBasedStorageThreadAffinity() const noexcept
SessionSettings & ignoreFileBasedStorageIntegrityErrors(bool)
Sets the file-based storage integrity errors checking mode.
SessionSettings & asyncFileBasedStorageQueueMaxSize(unsigned value)
Sets the maximum size of the asynchronous session storage queue.
SessionSettings & reconnectAttempts(unsigned reconnectAttempts)
Sets the maximum number of tries to restore the telecommunications link.
SessionSettings & threadingModel(ThreadingModel::Enum value)
Sets the threading model.
SessionSettings & localTimeUsage(bool)
Specifies the usage of the local time in Handler events and log files.
std::string toString() const
int socketReceiveBufferSize() const noexcept
const std::string & localNetworkInterface() const noexcept
SessionSettings & sendSpinningTimeout(unsigned usecTimeout)
Sets the send spinning timeout (microseconds).
unsigned reconnectInterval() const noexcept
SessionSettings & threadPoolPriority(int priority)
Sets the thread pool priority.
SessionSettings & socketSendBufferSize(int bufferSize)
Sets the size of the socket send buffer size.
bool reportNewMessagesWhileWaitingForMissedMessages() const noexcept
SessionSettings & threadPoolAffinity(const CpuIndexes &cpuIndexes)
Sets the thread pool affinity.
SessionSettings & useTLS(bool value)
Sets the value of the option to enable TLS.
unsigned threadPoolSize() const noexcept
unsigned short keepAliveInterval() const noexcept
SessionSettings & messageGrouping(unsigned value)
Sets the message grouping mode.
SessionSettings & reportNewMessagesWhileWaitingForMissedMessages(bool report)
Sets the option to report new messages even when the message gap is detected, and the reply on the Re...
SessionSettings & reconnectInterval(unsigned value)
Sets the time interval between retries to restore the telecommunications link (seconds).
SessionSettings & asyncFileBasedStorageThreadAffinity(const CpuIndexes &cpuIndexes)
Specifies the CPU index(es) for affinity of the asynchronous session storage threads.
const std::string & ipSessionToken() const noexcept
SessionSettings & socketReceiveBufferSize(int bufferSize)
Sets the socket receive buffer size.
int threadPoolPolicy() const noexcept
SessionSettings & enableRxTimestamp(bool value)
Sets the value of the option to enable received data timestamp.
unsigned asyncFileBasedStorageQueueMaxSize() const noexcept
const CpuIndexes & threadPoolAffinity() const noexcept
Messaging::SchemaVersion messagingSchemaVersion() const noexcept
SessionSettings & localNetworkInterface(const std::string &value)
Specifies the local interface from which the Handler connects to the counterparty.
SessionSettings & fileBasedStorageSegmentSize(Messaging::UInt64 value)
Sets the segment size for file-based session storage.
SessionSettings & useSpinLock(bool value)
Sets the value of the option to the option to use spin lock.
SessionSettings & logLevel(LogLevel::Enum value)
Sets the severity level of log messages.
SessionSettings & keepAliveInterval(unsigned short seconds)
Sets the longest time in seconds the client system can remain silent before sending a message.
unsigned receiveSpinningTimeout() const noexcept
SessionSettings & ipSessionToken(const std::string &value)
Sets the access key that was assigned by the exchange.
SessionSettings & reasonableTransmissionTime(unsigned percentage)
Sets the reasonable transmission time - as the percentage from the KeepAliveInterval value.
SessionSettings & userId(const std::string &value)
Sets the session id that was assigned by the exchange.
unsigned reconnectAttempts() const noexcept
SessionSettings & load(const std::string &configFile)
Loads the settings from the given configuration file.
SessionSettings & logBeforeSending(bool before)
Controls the order of logging and sending outbound messages.
bool enableRxTimestamp() const noexcept
bool tcpNoDelayOption() const noexcept
SessionSettings & storageDirectory(const std::string &value)
Sets the Session Storage directory.
SessionSettings & logFileName(const std::string &value)
Specifies the Handler log file name.
SessionSettings & loggerOptions(LogSettings::Enum value)
Sets the the logger options.
SessionSettings & rawData(const std::string &value)
Sets the secret key that was assigned by the exchange.
SessionSettings & localPortRange(PortRange range)
Sets the range of the local ports to be used.
SessionSettings & messagingSchemaVersion(Messaging::SchemaVersion schema)
Specifies the version of the message schema.
bool ignoreFileBasedStorageIntegrityErrors() const noexcept
Messaging::UInt64 fileBasedStorageSegmentSize() const noexcept
SessionSettings & receiveSpinningTimeout(unsigned usecTimeout)
Sets the receive spinning timeout (microseconds).
SessionSettings & addLicenseStore(const std::string &value)
Adds the path to the folder that contains license file(s).
bool logBeforeSending() const noexcept
SessionSettings & tcpNoDelayOption(bool value)
Sets the value of the option to improve latency at the expense of message throughput (the TCP_NODELAY...
SessionSettings & licenseStore(const std::string &value)
Sets the path to the folder that contains license file(s).
const LicenseStores & licenseStores() const noexcept
SessionSettings & threadPoolPolicy(int policy)
Sets the thread pool policy.
const std::string & rawData() const noexcept
SessionSettings & licenseAlertingDaysBeforeExpiration(unsigned days)
Sets the number of days to alert before the license expiration.
PortRange localPortRange() const noexcept
int threadPoolPriority() const noexcept
static const int UseOsDefaultSocketBufferSize
Specifies the usage of the operating system default socket buffer size.
unsigned sendSpinningTimeout() const noexcept
bool localTimeUsage() const noexcept
bool useSpinLock() const noexcept
const std::string & storageDirectory() const noexcept
SessionSettings & clientId(Messaging::Int32 value)
Sets the firm id that was assigned by the exchange.
LogSettings::Enum loggerOptions() const noexcept
std::vector< std::string > LicenseStores
Folders that contain license file(s).
ThreadingModel::Enum threadingModel() const noexcept
unsigned reasonableTransmissionTime() const noexcept
const std::string & logFileName() const noexcept
MessageHeader::Version SchemaVersion
SBE-encoded data version type.
std::pair< Port, Port > PortRange
Definition Defines.h:71
std::set< CpuIndex > CpuIndexes
Definition Defines.h:70
@ Info
General informational messages about normal operation.
Definition LogSettings.h:39
@ Default
Default log settings.
Definition LogSettings.h:72
static const bool ReportNewMessagesWhileWaitingForMissedMessages
static const unsigned AsyncFileBasedStorageQueueMaxSize
static const unsigned long long FileBasedStorageSegmentSize
static const LogLevel::Enum LogSeverity
static const unsigned LicenseAlertingDaysBeforeExpiration
static const LogSettings::Enum LoggerOptions
static const unsigned short KeepAliveInterval
static const ThreadingModel::Enum ThreadingModelValue
The keys that are used to load settings from the configuration file.
static const char * AsyncFileBasedStorageThreadAffinity
= "AsyncFileBasedStorage.ThreadAffinity"
static const char * ReconnectAttempts
= "Reconnect.Attempts"
static const char * SocketReceiveBufferSize
= "Socket.ReceiveBufferSize"
static const char * UseSpinLock
= "UseSpinLock"
static const char * UserId
= "UserId"
static const char * LicenseStore
= "LicenseStore"
static const char * EnableRxTimestamp
= "EnableRxTimestamp"
static const char * ThreadPoolAffinity
= "ThreadPool.Affinity"
static const char * ReasonableTransmissionTime
= "ReasonableTransmissionTime"
static const char * AsyncFileBasedStorageQueueMaxSize
= "AsyncFileBasedStorage.QueueMaxSize"
static const char * SendSpinningTimeout
= "SendSpinningTimeout"
static const char * UseTLS
= "UseTLS"
static const char * ThreadingModel
= "ThreadingModel"
static const char * RawData
= "RawData"
static const char * MessageGrouping
= "MessageGrouping"
static const char * LoggerOptions
= "LoggerOptions"
static const char * LogBeforeSending
= "Log.BeforeSending"
static const char * TcpNoDelayOption
= "TcpNoDelayOption"
static const char * KeepAliveInterval
= "KeepAliveInterval"
static const char * IgnoreFileBasedStorageIntegrityErrors
= "IgnoreFileBasedStorageIntegrityErrors"
static const char * LocalTimeUsage
= "LocalTimeUsage"
static const char * ThreadPoolPolicy
= "ThreadPool.Policy"
static const char * SocketSendBufferSize
= "Socket.SendBufferSize"
static const char * ThreadPoolPriority
= "ThreadPool.Priority"
static const char * ReportNewMessagesWhileWaitingForMissedMessages
= "ReportNewMessagesWhileWaitingForMissedMessages"
static const char * FileBasedStorageSegmentSize
= "FileBasedStorageSegmentSize"
static const char * LicenseAlertingDaysBeforeExpiration
= "LicenseAlertingDaysBeforeExpiration"
static const char * LocalNetworkInterface
= "LocalNetworkInterface"
static const char * LogFileName
= "Log.FileName"
static const char * ReconnectInterval
= "Reconnect.Interval"
static const char * StorageDirectory
= "Log.Directory"
static const char * MessagingSchemaVersion
= "MessagingSchemaVersion"
static const char * ThreadPoolSize
= "ThreadPool.Size"
static const char * LocalPortRange
= "LocalPortRange"
static const char * ReceiveSpinningTimeout
= "ReceiveSpinningTimeout"
static const char * ClientId
= "ClientId"
static const char * LogSeverity
= "LogSeverity"
@ Dedicated
Each session has a sender thread and a receiving thread.