OnixS C++ B3 BOE Binary Order Entry 1.4.0
Users' manual and 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/B3/BOE/ABI.h>
25
26#include <climits>
27#include <set>
28#include <string>
29#include <vector>
30
31namespace OnixS {
32namespace B3 {
33namespace BOE {
34
39{
40public:
43
49 return sessionId_;
50 }
51
55
60 Messaging::UInt32 enteringFirm() const ONIXS_B3_BOE_NOTHROW {
61 return enteringFirm_;
62 }
63
66 SessionSettings& enteringFirm(Messaging::UInt32 value);
67
72 const std::string & accessKey() const ONIXS_B3_BOE_NOTHROW {
73 return accessKey_;
74 }
75
78 SessionSettings& accessKey(const std::string & value);
79
87
91
96 const std::string & tradingSystemName() const ONIXS_B3_BOE_NOTHROW {
97 return tradingSystemName_;
98 }
99
102 SessionSettings& tradingSystemName(const std::string & value);
103
108 const std::string & tradingSystemVersion() const ONIXS_B3_BOE_NOTHROW {
109 return tradingSystemVersion_;
110 }
111
114 SessionSettings& tradingSystemVersion(const std::string & value);
115
121 return threadingModel_;
122 }
123
127
133 return receiveSpinningTimeout_;
134 }
135
139
145 return sendSpinningTimeout_;
146 }
147
150 SessionSettings& sendSpinningTimeout(unsigned usecTimeout);
151
161 return messageGrouping_;
162 }
163
167
170
173 SessionSettings& addLicenseStore(const std::string& value);
174
177 SessionSettings& licenseStore(const std::string & value);
178
180 typedef std::vector<std::string> LicenseStores;
181
187 return licenseStores_;
188 }
189
195 return licenseAlertingDaysBeforeExpiration_;
196 }
197
206 licenseAlertingDaysBeforeExpiration_ = days;
207 return *this;
208 }
209
214 const std::string & localNetworkInterface() const ONIXS_B3_BOE_NOTHROW {
215 return localNetworkInterface_;
216 }
217
223 SessionSettings& localNetworkInterface(const std::string & value);
224
229 const std::string & logFileName() const ONIXS_B3_BOE_NOTHROW {
230 return logFileName_;
231 }
232
235 SessionSettings& logFileName(const std::string & value);
236
243 const std::string & storageDirectory() const ONIXS_B3_BOE_NOTHROW {
244 return storageDirectory_;
245 }
246
251 SessionSettings& storageDirectory(const std::string & value);
252
258 return localTimeUsage_;
259 }
260
266
272 return fileBasedStorageSegmentSize_;
273 }
274
278
284 return asyncFileBasedStorageQueueMaxSize_;
285 }
286
290
296 return asyncFileBasedStorageThreadAffinity_;
297 }
298
302
311 return ignoreFileBasedStorageIntegrityErrors_;
312 }
313
317
323 return logBeforeSending_;
324 }
325
331
337 return reconnectAttempts_;
338 }
339
343
349 return reconnectInterval_;
350 }
351
356
358 static const int UseOsDefaultSocketBufferSize = -1;
359
365 return socketReceiveBufferSize_;
366 }
367
374
380 return reasonableTransmissionTime_;
381 }
382
388
394 return socketSendBufferSize_;
395 }
396
403
407 return threadPoolAffinity_;
408 }
409
413
417 return threadPoolPriority_;
418 }
419
423
427 return threadPoolPolicy_;
428 }
429
433
439 return tcpNoDelayOption_;
440 }
441
445
451 return threadPoolSize_;
452 }
453
456 SessionSettings& threadPoolSize(unsigned numberOfThreads);
457
463 return keepAliveInterval_;
464 }
465
471 SessionSettings& keepAliveInterval(unsigned milliseconds);
472
478 return codTimeoutWindow_;
479 }
480
487 SessionSettings& codTimeoutWindow(unsigned milliseconds);
488
495 return reportNewMessagesWhileWaitingForMissedMessages_;
496 }
497
502
506
510 return localPortRange_;
511 }
512
518
522 return messagingSchemaVersion_;
523 }
524
530 return useSpinLock_;
531 }
532
536
542 return enableRxTimestamp_;
543 }
544
549
554 SessionSettings& load(const std::string& configFile);
555
558 std::string toString() const;
559
564 static const bool CreateLogFile = true;
565 static const int KeepAliveInterval = 30000;
566 static const int CodTimeoutWindow = 30000;
567 static const bool LogBeforeSending = true;
570 static const bool TcpNoDelayOption = true;
571 static const int ReceiveSpinningTimeout = 0;
572 static const int SendSpinningTimeout = 0;
573 static const char LicenseStore[] ;
574 static const unsigned LicenseAlertingDaysBeforeExpiration = 0;
575 static const char LogDir[];
576 static const char LogFileName[];
577 static const bool LocalTimeUsage = false;
578 static const unsigned MessageGrouping = 0;
579 static const int ReasonableTransmissionTime = 20;
580 static const int ReconnectAttempts = 3;
581 static const int ReconnectInterval = 180;
582 static const unsigned long long FileBasedStorageSegmentSize = 0;
583 static const bool IgnoreFileBasedStorageIntegrityErrors = false;
584 static const int ThreadPoolSize = 0;
586 static const unsigned AsyncFileBasedStorageQueueMaxSize = UINT_MAX;
587 static const bool UseSpinLock = false;
588 static const bool EnableRxTimestamp = false;
589 };
590
593 static const char * SessionId;
594 static const char * EnteringFirm;
595 static const char * AccessKey;
596 static const char * CancelOnDisconnectType;
597 static const char * TradingSystemName;
598 static const char * TradingSystemVersion;
599
602 static const char * ThreadingModel;
603 static const char * TcpNoDelayOption;
604 static const char * MessageGrouping;
605 static const char * FileBasedStorageSegmentSize;
607 static const char * KeepAliveInterval;
608 static const char * CodTimeoutWindow;
609 static const char * LicenseFile;
610 static const char * LicenseStore;
612 static const char * LocalNetworkInterface;
613 static const char * LogFileName;
614 static const char * LocalTimeUsage;
615 static const char * LogBeforeSending;
616 static const char * ReasonableTransmissionTime;
617 static const char * ReceiveSpinningTimeout;
618 static const char * ReconnectAttempts;
619 static const char * ReconnectInterval;
620 static const char * SendSpinningTimeout;
621 static const char * ThreadPoolAffinity;
622 static const char * ThreadPoolSize;
623 static const char * ThreadPoolPriority;
624 static const char * ThreadPoolPolicy;
625 static const char * SocketReceiveBufferSize;
626 static const char * SocketSendBufferSize;
627 static const char * StorageDirectory;
629 static const char * MessagingSchemaVersion;
630 static const char * LocalPortRange;
631 static const char * UseSpinLock;
632 static const char * EnableRxTimestamp;
633 };
634
635private:
636 void processLicenseStores(const std::string& licenseStore);
637
638 std::string accessKey_;
639
640 unsigned asyncFileBasedStorageQueueMaxSize_;
641
642 CpuIndexes asyncFileBasedStorageThreadAffinity_;
643
644 bool createEngineLogFile_;
645
646 Messaging::UInt64 fileBasedStorageSegmentSize_;
647
648 Messaging::UInt32 enteringFirm_;
649
650 Messaging::CancelOnDisconnectType::Enum cancelOnDisconnectType_;
651
652 bool ignoreFileBasedStorageIntegrityErrors_;
653
654 unsigned keepAliveInterval_;
655
656 unsigned codTimeoutWindow_;
657
658 unsigned licenseAlertingDaysBeforeExpiration_;
659
660 std::string licenseFilePath_;
661
662 LicenseStores licenseStores_;
663
664 std::string localNetworkInterface_;
665
666 bool localTimeUsage_;
667
668 bool logBeforeSending_;
669
670 std::string logFileName_;
671
672 unsigned messageGrouping_;
673
674 unsigned reasonableTransmissionTime_;
675
676 int receiveSpinningTimeout_;
677
678 unsigned reconnectAttempts_;
679
680 unsigned reconnectInterval_;
681
682 bool reportNewMessagesWhileWaitingForMissedMessages_;
683
684 int sendSpinningTimeout_;
685
686 Messaging::SessionID sessionId_;
687
688 int socketReceiveBufferSize_;
689
690 int socketSendBufferSize_;
691
692 std::string storageDirectory_;
693
694 bool tcpNoDelayOption_;
695
696 ThreadingModel::Enum threadingModel_;
697
698 CpuIndexes threadPoolAffinity_;
699
700 int threadPoolPolicy_;
701
702 int threadPoolPriority_;
703
704 unsigned threadPoolSize_;
705
706 std::string tradingSystemName_;
707
708 std::string tradingSystemVersion_;
709
710 std::pair<Port, Port> localPortRange_;
711
712 Messaging::SchemaVersion messagingSchemaVersion_;
713
714 bool useSpinLock_;
715
716 bool enableRxTimestamp_;
717};
718
719}
720}
721}
#define ONIXS_B3_BOE_NODISCARD
Definition Compiler.h:191
#define ONIXS_B3_BOE_EXPORTED
Definition Compiler.h:181
#define ONIXS_B3_BOE_NOTHROW
Definition Compiler.h:182
int socketSendBufferSize() 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
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)
Messaging::UInt32 enteringFirm() const noexcept
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 & keepAliveInterval(unsigned milliseconds)
SessionSettings & threadPoolPriority(int priority)
Sets the thread pool priority.
SessionSettings & socketSendBufferSize(int bufferSize)
bool reportNewMessagesWhileWaitingForMissedMessages() const noexcept
SessionSettings & threadPoolAffinity(const CpuIndexes &cpuIndexes)
Sets the thread pool affinity.
SessionSettings & tradingSystemName(const std::string &value)
Sets the trading system name.
unsigned threadPoolSize() const noexcept
SessionSettings & messageGrouping(unsigned value)
Sets the message grouping mode.
SessionSettings & reportNewMessagesWhileWaitingForMissedMessages(bool report)
SessionSettings & reconnectInterval(unsigned value)
SessionSettings & asyncFileBasedStorageThreadAffinity(const CpuIndexes &cpuIndexes)
Specifies the CPU index(es) for affinity of the asynchronous session storage threads.
SessionSettings & socketReceiveBufferSize(int bufferSize)
int threadPoolPolicy() const noexcept
SessionSettings & enableRxTimestamp(bool value)
unsigned asyncFileBasedStorageQueueMaxSize() const noexcept
const CpuIndexes & threadPoolAffinity() const noexcept
Messaging::SchemaVersion messagingSchemaVersion() const noexcept
SessionSettings & localNetworkInterface(const std::string &value)
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.
unsigned receiveSpinningTimeout() const noexcept
SessionSettings & reasonableTransmissionTime(unsigned percentage)
Messaging::SessionID sessionId() const noexcept
unsigned reconnectAttempts() const noexcept
unsigned codTimeoutWindow() const noexcept
SessionSettings & load(const std::string &configFile)
SessionSettings & sessionId(Messaging::SessionID value)
Sets the session id that was assigned by the exchange.
SessionSettings & logBeforeSending(bool before)
bool enableRxTimestamp() const noexcept
bool tcpNoDelayOption() const noexcept
SessionSettings & storageDirectory(const std::string &value)
SessionSettings & codTimeoutWindow(unsigned milliseconds)
SessionSettings & logFileName(const std::string &value)
Specifies the Handler log file name.
SessionSettings & accessKey(const std::string &value)
Sets the token provided by B3 for the FIXP session.
SessionSettings & localPortRange(PortRange range)
Sets the range of the local ports to be used.
SessionSettings & messagingSchemaVersion(Messaging::SchemaVersion schema)
bool ignoreFileBasedStorageIntegrityErrors() 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).
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...
Messaging::CancelOnDisconnectType::Enum cancelOnDisconnectType() const noexcept
SessionSettings & tradingSystemVersion(const std::string &value)
Sets the trading system version.
SessionSettings & cancelOnDisconnectType(Messaging::CancelOnDisconnectType::Enum value)
Sets the criteria used to initiate cancel on disconnect mechanism by the gateway.
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 & enteringFirm(Messaging::UInt32 value)
Sets the broker firm id that will enter orders.
SessionSettings & threadPoolPolicy(int policy)
Sets the thread pool policy.
SessionSettings & licenseAlertingDaysBeforeExpiration(unsigned days)
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
unsigned keepAliveInterval() const noexcept
bool localTimeUsage() const noexcept
bool useSpinLock() const noexcept
const std::string & storageDirectory() 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
Enum
Criteria used to initiate cancel on disconnect mechanism by the gateway.
Definition Fields.h:1423
@ DoNotCancelOnDisconnectOrTerminate
DoNotCancelOnDisconnectOrTerminate.
Definition Fields.h:1425
static const bool ReportNewMessagesWhileWaitingForMissedMessages
static const Messaging::CancelOnDisconnectType::Enum CancelOnDisconnectType
static const unsigned AsyncFileBasedStorageQueueMaxSize
static const unsigned long long FileBasedStorageSegmentSize
static const unsigned LicenseAlertingDaysBeforeExpiration
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 * 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 * EnteringFirm
= "EnteringFirm"
static const char * SendSpinningTimeout
= "SendSpinningTimeout"
static const char * LicenseFile
= "LicenseFile"
static const char * ThreadingModel
= "ThreadingModel"
static const char * MessageGrouping
= "MessageGrouping"
static const char * CodTimeoutWindow
= "CodTimeoutWindow"
static const char * TradingSystemName
= "TradingSystem.Name"
static const char * LogBeforeSending
= "Log.BeforeSending"
static const char * TcpNoDelayOption
= "TcpNoDelayOption"
static const char * CancelOnDisconnectType
= "CancelOnDisconnectType"
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 * 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"
@ Dedicated
Each session has a sender thread and a receiving thread.