OnixS C++ CME iLink 3 Binary Order Entry Handler 1.19.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
26
27#include <climits>
28#include <set>
29#include <string>
30#include <vector>
31
32namespace OnixS {
33namespace CME {
34namespace iLink3 {
35
40{
41public:
44
49 const std::string & sessionId() const noexcept {
50 return sessionId_;
51 }
52
55 SessionSettings& sessionId(const std::string & value);
56
61 const std::string & firmId() const noexcept {
62 return firmId_;
63 }
64
67 SessionSettings& firmId(const std::string & value);
68
73 const std::string & accessKey() const noexcept {
74 return accessKey_;
75 }
76
79 SessionSettings& accessKey(const std::string & value);
80
85 const std::string & secretKey() const noexcept {
86 return secretKey_;
87 }
88
91 SessionSettings& secretKey(const std::string & value);
92
97 const std::string & tradingSystemName() const noexcept {
98 return tradingSystemName_;
99 }
100
103 SessionSettings& tradingSystemName(const std::string & value);
104
109 const std::string & tradingSystemVersion() const noexcept {
110 return tradingSystemVersion_;
111 }
112
115 SessionSettings& tradingSystemVersion(const std::string & value);
116
121 const std::string & tradingSystemVendor() const noexcept {
122 return tradingSystemVendor_;
123 }
124
127 SessionSettings& tradingSystemVendor(const std::string & value);
128
134 return threadingModel_;
135 }
136
140
145 unsigned receiveSpinningTimeout() const noexcept {
146 return receiveSpinningTimeout_;
147 }
148
152
157 unsigned sendSpinningTimeout() const noexcept {
158 return sendSpinningTimeout_;
159 }
160
163 SessionSettings& sendSpinningTimeout(unsigned usecTimeout);
164
173 unsigned messageGrouping() const noexcept{
174 return messageGrouping_;
175 }
176
180
183
186 SessionSettings& addLicenseStore(const std::string& value);
187
190 SessionSettings& licenseStore(const std::string & value);
191
193 typedef std::vector<std::string> LicenseStores;
194
199 const LicenseStores& licenseStores() const noexcept {
200 return licenseStores_;
201 }
202
207 unsigned licenseAlertingDaysBeforeExpiration() const noexcept {
208 return licenseAlertingDaysBeforeExpiration_;
209 }
210
219 licenseAlertingDaysBeforeExpiration_ = days;
220 return *this;
221 }
222
227 const std::string & localNetworkInterface() const noexcept {
228 return localNetworkInterface_;
229 }
230
236 SessionSettings& localNetworkInterface(const std::string & value);
237
242 const std::string & logFileName() const noexcept {
243 return logFileName_;
244 }
245
248 SessionSettings& logFileName(const std::string & value);
249
256 const std::string & storageDirectory() const noexcept {
257 return storageDirectory_;
258 }
259
264 SessionSettings& storageDirectory(const std::string & value);
265
270 bool localTimeUsage() const noexcept {
271 return localTimeUsage_;
272 }
273
279
285 return fileBasedStorageSegmentSize_;
286 }
287
291
296 unsigned asyncFileBasedStorageQueueMaxSize() const noexcept {
297 return asyncFileBasedStorageQueueMaxSize_;
298 }
299
303
309 return asyncFileBasedStorageThreadAffinity_;
310 }
311
315
324 return ignoreFileBasedStorageIntegrityErrors_;
325 }
326
330
335 bool logBeforeSending() const noexcept {
336 return logBeforeSending_;
337 }
338
344
349 unsigned reconnectAttempts() const noexcept {
350 return reconnectAttempts_;
351 }
352
356
361 unsigned reconnectInterval() const noexcept {
362 return reconnectInterval_;
363 }
364
369
371 static const int UseOsDefaultSocketBufferSize = -1;
372
377 int socketReceiveBufferSize() const noexcept {
378 return socketReceiveBufferSize_;
379 }
380
387
392 unsigned reasonableTransmissionTime() const noexcept {
393 return reasonableTransmissionTime_;
394 }
395
399
404 int socketSendBufferSize() const noexcept {
405 return socketSendBufferSize_;
406 }
407
414
417 const CpuIndexes & threadPoolAffinity() const noexcept {
418 return threadPoolAffinity_;
419 }
420
424
427 int threadPoolPriority() const noexcept {
428 return threadPoolPriority_;
429 }
430
434
437 int threadPoolPolicy() const noexcept {
438 return threadPoolPolicy_;
439 }
440
444
449 bool tcpNoDelayOption() const noexcept {
450 return tcpNoDelayOption_;
451 }
452
456
461 unsigned threadPoolSize() const noexcept {
462 return threadPoolSize_;
463 }
464
467 SessionSettings& threadPoolSize(unsigned numberOfThreads);
468
473 unsigned keepAliveInterval() const noexcept {
474 return keepAliveInterval_;
475 }
476
482 SessionSettings& keepAliveInterval(unsigned milliseconds);
483
491 return reportNewMessagesWhileWaitingForMissedMessages_;
492 }
493
499
503
506 PortRange localPortRange() const noexcept {
507 return localPortRange_;
508 }
509
515
519 return messagingSchemaVersion_;
520 }
521
526 bool detectMessageGapForPreviousUuid() const noexcept {
527 return detectMessageGapForPreviousUuid_;
528 }
529
533
538 bool useSpinLock() const noexcept {
539 return useSpinLock_;
540 }
541
545
550 bool enableRxTimestamp() const noexcept {
551 return enableRxTimestamp_;
552 }
553
558 LogLevel::Enum logLevel() const noexcept {
559 return logLevel_;
560 }
561
565
571 return loggerOptions_;
572 }
573
577
582
587 SessionSettings& load(const std::string& configFile);
588
591 std::string toString() const;
592
596 static const bool CreateLogFile = true;
597 static const int KeepAliveInterval = 30000;
598 static const bool LogBeforeSending = true;
601 static const bool TcpNoDelayOption = true;
602 static const int ReceiveSpinningTimeout = 0;
603 static const int SendSpinningTimeout = 0;
604 static const char LicenseStore[] ;
605 static const unsigned LicenseAlertingDaysBeforeExpiration = 0;
606 static const char LogDir[];
607 static const char LogFileName[];
608 static const bool LocalTimeUsage = false;
609 static const unsigned MessageGrouping = 0;
610 static const int ReasonableTransmissionTime = 20;
611 static const int ReconnectAttempts = 3;
612 static const int ReconnectInterval = 180;
613 static const unsigned long long FileBasedStorageSegmentSize = 0;
614 static const bool IgnoreFileBasedStorageIntegrityErrors = false;
615 static const int ThreadPoolSize = 0;
617 static const unsigned AsyncFileBasedStorageQueueMaxSize = UINT_MAX;
618 static const bool DetectMessageGapForPreviousUuid = true;
619 static const bool UseSpinLock = false;
620 static const bool EnableRxTimestamp = false;
623 };
624
627 static const char * SessionId;
628 static const char * FirmId;
629 static const char * AccessKey;
630 static const char * SecretKey;
631 static const char * TradingSystemName;
632 static const char * TradingSystemVersion;
633 static const char * TradingSystemVendor;
634
637 static const char * ThreadingModel;
638 static const char * TcpNoDelayOption;
639 static const char * MessageGrouping;
640 static const char * FileBasedStorageSegmentSize;
642 static const char * KeepAliveInterval;
643 static const char * LicenseFile;
644 static const char * LicenseStore;
646 static const char * LocalNetworkInterface;
647 static const char * LogFileName;
648 static const char * LocalTimeUsage;
649 static const char * LogBeforeSending;
650 static const char * ReasonableTransmissionTime;
651 static const char * ReceiveSpinningTimeout;
652 static const char * ReconnectAttempts;
653 static const char * ReconnectInterval;
654 static const char * SendSpinningTimeout;
655 static const char * ThreadPoolAffinity;
656 static const char * ThreadPoolSize;
657 static const char * ThreadPoolPriority;
658 static const char * ThreadPoolPolicy;
659 static const char * SocketReceiveBufferSize;
660 static const char * SocketSendBufferSize;
661 static const char * StorageDirectory;
663 static const char * MessagingSchemaVersion;
664 static const char * LocalPortRange;
666 static const char * UseSpinLock;
667 static const char * EnableRxTimestamp;
668 static const char * LogSeverity;
669 static const char * LoggerOptions;
670 };
671
672private:
673 void processLicenseStores(const std::string& licenseStore);
674
675 std::string accessKey_;
676
677 unsigned asyncFileBasedStorageQueueMaxSize_;
678
679 CpuIndexes asyncFileBasedStorageThreadAffinity_;
680
681 bool createEngineLogFile_;
682
683 Messaging::UInt64 fileBasedStorageSegmentSize_;
684
685 std::string firmId_;
686
687 bool ignoreFileBasedStorageIntegrityErrors_;
688
689 unsigned keepAliveInterval_;
690
691 unsigned licenseAlertingDaysBeforeExpiration_;
692
693 std::string licenseFilePath_;
694
695 LicenseStores licenseStores_;
696
697 std::string localNetworkInterface_;
698
699 bool localTimeUsage_;
700
701 bool logBeforeSending_;
702
703 std::string logFileName_;
704
705 unsigned messageGrouping_;
706
707 unsigned reasonableTransmissionTime_;
708
709 int receiveSpinningTimeout_;
710
711 unsigned reconnectAttempts_;
712
713 unsigned reconnectInterval_;
714
715 bool reportNewMessagesWhileWaitingForMissedMessages_;
716
717 std::string secretKey_;
718
719 int sendSpinningTimeout_;
720
721 std::string sessionId_;
722
723 int socketReceiveBufferSize_;
724
725 int socketSendBufferSize_;
726
727 std::string storageDirectory_;
728
729 bool tcpNoDelayOption_;
730
731 ThreadingModel::Enum threadingModel_;
732
733 CpuIndexes threadPoolAffinity_;
734
735 int threadPoolPolicy_;
736
737 int threadPoolPriority_;
738
739 unsigned threadPoolSize_;
740
741 std::string tradingSystemName_;
742
743 std::string tradingSystemVendor_;
744
745 std::string tradingSystemVersion_;
746
747 std::pair<Port, Port> localPortRange_;
748
749 Messaging::SchemaVersion messagingSchemaVersion_;
750
751 bool detectMessageGapForPreviousUuid_;
752
753 bool useSpinLock_;
754
755 bool enableRxTimestamp_;
756
757 LogLevel::Enum logLevel_;
758
759 LogSettings::Enum loggerOptions_;
760};
761
762}
763}
764}
#define ONIXS_ILINK3_NODISCARD
Definition Compiler.h:147
#define ONIXS_ILINK3_EXPORTED
Definition Compiler.h:145
int socketSendBufferSize() const noexcept
LogLevel::Enum logLevel() const noexcept
unsigned messageGrouping() const noexcept
SessionSettings & threadPoolSize(unsigned numberOfThreads)
Sets the size of the shared thread pool.
unsigned licenseAlertingDaysBeforeExpiration() const noexcept
SessionSettings & resetToDefaults()
Resets the settings to the default values.
const CpuIndexes & asyncFileBasedStorageThreadAffinity() const noexcept
const std::string & secretKey() 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.
const std::string & firmId() const noexcept
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.
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 & keepAliveInterval(unsigned milliseconds)
Sets the longest time in milliseconds the client system can remain silent before sending a message.
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 & secretKey(const std::string &value)
Sets the secret key that was assigned by the exchange.
SessionSettings & tradingSystemName(const std::string &value)
Sets the trading system name.
unsigned threadPoolSize() const noexcept
SessionSettings & messageGrouping(unsigned value)
Sets the message grouping mode.
const std::string & tradingSystemVendor() const noexcept
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.
SessionSettings & socketReceiveBufferSize(int bufferSize)
Sets the socket receive buffer size.
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 & detectMessageGapForPreviousUuid(bool detectGap)
Sets the value of the option to detect the message gap for the previous UUID.
SessionSettings & sessionId(const std::string &value)
Sets the session id that was assigned by the exchange.
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.
const std::string & sessionId() const noexcept
SessionSettings & tradingSystemVendor(const std::string &value)
Sets the trading system vendor.
unsigned receiveSpinningTimeout() const noexcept
SessionSettings & reasonableTransmissionTime(unsigned percentage)
Sets the reasonable transmission time - as the percentage from the KeepAliveInterval value.
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
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 & accessKey(const std::string &value)
Sets the access 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
bool detectMessageGapForPreviousUuid() const noexcept
Messaging::UInt64 fileBasedStorageSegmentSize() const noexcept
SessionSettings & receiveSpinningTimeout(unsigned usecTimeout)
Sets the receive spinning timeout (microseconds).
const std::string & tradingSystemName() const noexcept
SessionSettings & addLicenseStore(const std::string &value)
Adds the path to the folder that contains license file(s).
SessionSettings & tcpNoDelayOption(bool value)
Sets the value of the option to improve latency at the expense of message throughput (the TCP_NODELAY...
SessionSettings & tradingSystemVersion(const std::string &value)
Sets the trading system version.
const std::string & tradingSystemVersion() const noexcept
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.
SessionSettings & firmId(const std::string &value)
Sets the firm id that was assigned by the exchange.
SessionSettings & licenseAlertingDaysBeforeExpiration(unsigned days)
Sets the number of days to alert before the license expiration.
PortRange localPortRange() const noexcept
static const int UseOsDefaultSocketBufferSize
Specifies the usage of the operating system default socket buffer size.
unsigned sendSpinningTimeout() const noexcept
unsigned keepAliveInterval() const noexcept
const std::string & storageDirectory() const noexcept
LogSettings::Enum loggerOptions() const noexcept
std::vector< std::string > LicenseStores
Folders that contain license file(s).
const std::string & accessKey() const noexcept
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:74
std::set< CpuIndex > CpuIndexes
Definition Defines.h:73
@ Info
General informational messages about normal operation.
Definition LogSettings.h:42
@ Default
Default log settings.
Definition LogSettings.h:75
static const unsigned long long FileBasedStorageSegmentSize
static const unsigned LicenseAlertingDaysBeforeExpiration
static const LogSettings::Enum LoggerOptions
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 * DetectMessageGapForPreviousUuid
= "DetectMessageGapForPreviousUuid"
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 * LicenseFile
= "LicenseFile"
static const char * ThreadingModel
= "ThreadingModel"
static const char * MessageGrouping
= "MessageGrouping"
static const char * LoggerOptions
= "LoggerOptions"
static const char * TradingSystemName
= "TradingSystem.Name"
static const char * LogBeforeSending
= "Log.BeforeSending"
static const char * TcpNoDelayOption
= "TcpNoDelayOption"
static const char * FirmId
= "FirmId"
static const char * TradingSystemVendor
= "TradingSystem.Vendor"
static const char * KeepAliveInterval
= "KeepAliveInterval"
static const char * IgnoreFileBasedStorageIntegrityErrors
= "IgnoreFileBasedStorageIntegrityErrors"
static const char * LocalTimeUsage
= "LocalTimeUsage"
static const char * SessionId
= "SessionId"
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 * SecretKey
= "SecretKey"
static const char * ReconnectInterval
= "Reconnect.Interval"
static const char * StorageDirectory
= "Log.Directory"
static const char * AccessKey
= "AccessKey"
static const char * MessagingSchemaVersion
= "MessagingSchemaVersion"
static const char * ThreadPoolSize
= "ThreadPool.Size"
static const char * LocalPortRange
= "LocalPortRange"
static const char * ReceiveSpinningTimeout
= "ReceiveSpinningTimeout"
static const char * TradingSystemVersion
= "TradingSystem.Version"
static const char * LogSeverity
= "LogSeverity"
@ Dedicated
Each session has a sender thread and a receiving thread.