OnixS C++ CME iLink 3 Binary Order Entry Handler 1.19.0
API Documentation
Loading...
Searching...
No Matches
SessionScheduler.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
27
28#include <set>
29#include <string>
30
31namespace OnixS {
32namespace CME {
33namespace iLink3 {
34namespace Scheduling {
35
37
38typedef std::string SessionScheduleId;
39typedef std::string SessionConnectionSettingsId;
40
43{
44public:
54 virtual void onLoggingOut(const SessionScheduler & scheduler, Session * session, bool * allowLogout) = 0;
55
57 virtual void onWarning(const SessionScheduler & scheduler, Session * session, const std::string & warningReason) = 0;
58
60 virtual void onError(const SessionScheduler & scheduler, Session * session, const std::string & errorReason) = 0;
61
62protected:
63 virtual ~SessionSchedulerListener() = default;
64};
65
81
84{
85public:
87
89
91 const std::string & configurationFile() const noexcept;
92
94 SessionSchedulerOptions &configurationFile(const std::string &file);
95
98
101
104
107
108private:
109 std::string * configurationFile_;
110 SessionSchedulerListener * eventListener_;
111 SchedulerThreadingModel::Enum threadingModel_;
112};
113
116{
117public:
118 static const size_t TimeResolutionMs = 10;
119
121
124
130
136
146 SessionScheduler& add(Session *session, const SessionSchedule &schedule, const SessionConnectionSettings &connection);
147
157 SessionScheduler &add(Session *session, const SessionScheduleId &scheduleId, const SessionConnectionSettingsId &connectionId);
158
161
167
170
173
176
180 int reconnectAttempts() const;
181
184
188 int reconnectInterval() const;
189
192
196 bool utcTimeUsage() const;
197
198private:
199 class Impl;
200 Impl * impl_;
201};
202}
203}
204}
205}
#define ONIXS_ILINK3_EXPORTED
Definition Compiler.h:145
virtual void onWarning(const SessionScheduler &scheduler, Session *session, const std::string &warningReason)=0
Notifies about a non-critical issue.
virtual void onError(const SessionScheduler &scheduler, Session *session, const std::string &errorReason)=0
Notifies about an error.
virtual void onLoggingOut(const SessionScheduler &scheduler, Session *session, bool *allowLogout)=0
Notifies that the session is about to be closed.
SchedulerThreadingModel::Enum threadingModel() const noexcept
The threading model.
const std::string & configurationFile() const noexcept
SessionSchedulerListener * eventListener() const noexcept
SessionScheduler & add(Session *session, const SessionSchedule &schedule, const SessionConnectionSettings &connection)
Adds the session to the automatic connection management.
SessionScheduler & utcTimeUsage(bool value)
Activates the UTC usage.
SessionScheduler & add(Session *session, const SessionScheduleId &scheduleId, const SessionConnectionSettingsId &connectionId)
Adds the session to the automatic connection management.
SessionScheduler & serviceThreadAffinity(const OnixS::CME::iLink3::CpuIndexes &cpuIndexes)
Sets the CPU affinity for the Scheduler service thread.
SessionScheduler(const SessionSchedulerOptions &options)
const SessionConnectionSettings * findConnectionSettings(const SessionConnectionSettingsId &id) const
Looks for the predefined session connection settings associated with the given id that was specified ...
const OnixS::CME::iLink3::CpuIndexes & serviceThreadAffinity() const noexcept
~SessionScheduler()
Performs the graceful shutdown of scheduling sessions.
SessionScheduler & reconnectInterval(int value)
Sets the time interval between the logon attempts in case of a logon failure (in seconds).
SessionScheduler & reconnectAttempts(int value)
Sets the number of logon attempts in case of a logon failure.
const SessionSchedule * findSchedule(const SessionScheduleId &id) const
Looks for the predefined session schedule associated with the given id that was specified in Schedule...
SessionScheduler & remove(Session *session)
Removes the session from the automatic connection management services.
void dispatchEvents()
Processes events on the Scheduler and performs the necessary session management.
An iLink 3 Session.
Definition Session.h:48
std::set< CpuIndex > CpuIndexes
Definition Defines.h:73
The way in which the Scheduler will utilize threads.
static const char * toString(SchedulerThreadingModel::Enum value)
Returns the textual representation of the SchedulerThreadingModel::Enum value.
@ External
Scheduler events are handled by rolling an event loop in a user thread.