OnixS C++ FIX Engine 4.13.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
22#include <string>
23#include <set>
24
25#include <OnixS/FIXEngine/ABI.h>
26
28
29namespace OnixS {
30namespace FIX {
32
33namespace Scheduling {
35
39
40typedef std::string SessionScheduleId;
41typedef std::string SessionConnectionSettingsId;
42
44class
47{
48public:
56 virtual
57 void
59 const SessionScheduler & scheduler,
60 Session * session,
61 bool * allowLogout) = 0;
62
67 virtual
68 void
73
76 virtual
77 void
79 const SessionScheduler & scheduler,
80 Session * session,
81 const std::string & warningReason) = 0;
82
85 virtual
86 void
88 const SessionScheduler & scheduler,
89 Session * session,
90 const std::string & errorReason) = 0;
91
92protected:
96};
97
113
116class
119{
120public:
123
126
128 const std::string & configurationFile() const;
129
131 void configurationFile(const std::string & file);
132
135
138
141
144
145private:
146 std::string * configurationFile_;
147 SessionSchedulerListener * eventListener_;
148 SchedulerThreadingModel::Enum threadingModel_;
149};
150
156{
157public:
165 const SessionSchedulerOptions & options);
166
169
174 const
177
182 const
185 const SessionConnectionSettingsId & id) const;
186
200 void
202 Session * session,
203 const SessionSchedule & schedule,
204 const SessionConnectionSettings & connection);
205
219 void
221 Session * session,
222 const SessionScheduleId & scheduleId,
223 const SessionConnectionSettingsId & connectionId);
224
227 void remove(Session * session);
228
231 bool isScheduled(Session * session);
232
238
243
248
252 void reconnectAttempts(int value);
253
258 int reconnectAttempts() const;
259
263 void reconnectInterval(int value);
264
269 int reconnectInterval() const;
270
274 void utcTimeUsage(bool value);
275
280 bool utcTimeUsage() const;
281
282private:
283 class Impl;
284 Impl * impl_;
285};
286}
287}
288}
#define ONIXS_FIXENGINE_API_DECL(typeKind, typeName)
Definition ABI.h:57
#define ONIXS_FIXENGINE_API
Definition ABI.h:45
#define ONIXS_FIXENGINE_DEFAULT
Definition Compiler.h:194
The collection of parameters required to establish a connection with a counterparty (session-acceptor...
The collection of connection-related attributes for the session.
Defines activity time frames for the session.
SessionScheduler events notifications.
virtual void onWarning(const SessionScheduler &scheduler, Session *session, const std::string &warningReason)=0
Notifies about a non-critical issue occurred while maintaining the state for the given session.
virtual void onError(const SessionScheduler &scheduler, Session *session, const std::string &errorReason)=0
Notifies about an error occurred while maintaining the state for the given session.
virtual void onLoggingOut(const SessionScheduler &scheduler, Session *session, bool *allowLogout)=0
Notifies if the FIX session is about to be closed.
virtual ~SessionSchedulerListener() ONIXS_FIXENGINE_DEFAULT
The class is not used for the object life time managing.
virtual void onInitiatorConnecting(const SessionScheduler &, Session *, const Counterparty &)
Allows scheduler's users to be notified when an initiator will try to connect to the next counterpart...
The collection of miscellaneous parameters which affect the session scheduler behavior.
SchedulerThreadingModel::Enum threadingModel() const
The threading model.
const std::string & configurationFile() const
The path to the scheduler configuration file.
SessionSchedulerListener * eventListener() const
An instance of the event listener to notify about events.
void configurationFile(const std::string &file)
Updates the path to the scheduler configuration file.
void threadingModel(SchedulerThreadingModel::Enum threadingModel)
Updates the threading model.
SessionSchedulerOptions()
Initializes parameters with default values.
void eventListener(SessionSchedulerListener *listener)
Associates the given event listener with the scheduler.
The scheduler performs the session connection maintenance according to the specified schedule for ses...
int reconnectInterval() const
Returns the time interval between logon attempts in case of a logon failure.
bool utcTimeUsage() const
Returns true if the UTC time is used otherwise false.
int reconnectAttempts() const
Returns the number of logon attempts in case of a logon failure.
SessionScheduler(const SessionSchedulerOptions &options)
Initializes the Scheduler instance according to the options specified in the given configuration file...
void reconnectInterval(int value)
Sets the time interval between logon attempts in case of a logon failure.
void add(Session *session, const SessionSchedule &schedule, const SessionConnectionSettings &connection)
Adds the session to the automatic connection management.
void add(Session *session, const SessionScheduleId &scheduleId, const SessionConnectionSettingsId &connectionId)
Adds the session to the automatic connection management.
void serviceThreadAffinity(const OnixS::Threading::CpuIndexes &cpuIndexes)
Sets the CPU affinity of the Scheduler service thread.
const SessionConnectionSettings * findConnectionSettings(const SessionConnectionSettingsId &id) const
Looks for the predefined session connection settings associated with the given unique names (ids) as ...
~SessionScheduler()
Performs the graceful shutdown of scheduling services.
void utcTimeUsage(bool value)
This property allows switching the local time to the UTC time usage.
const SessionSchedule * findSchedule(const SessionScheduleId &id) const
Looks for the predefined session schedule associated with the given unique names (ids) as it was spec...
const OnixS::Threading::CpuIndexes & serviceThreadAffinity() const
Returns the CPU affinity of the Scheduler service thread.
bool isScheduled(Session *session)
Checks if the session is scheduled for the automatic connection management services.
void remove(Session *session)
Removes the session from the automatic connection management services.
void reconnectAttempts(int value)
Sets the number of logon attempts in case of a logon failure.
void dispatchEvents()
Processes events on the Scheduler and performs the necessary session management.
The FIX Session - a bi-directional stream of ordered messages between two parties within a continuous...
Definition Session.h:98
std::string SessionConnectionSettingsId
std::set< CpuIndex > CpuIndexes
Definition Thread.h:32
The way in which the Scheduler will utilize threads.
@ DedicatedThreads
Scheduler will use its own threads.
@ ExternalThread
Scheduler events are handled by rolling an event loop in a user thread.
static ONIXS_FIXENGINE_API const char * toString(SchedulerThreadingModel::Enum value)
Returns the textual representation of the SchedulerThreadingModel::Enum value.