OnixS C++ ICE Binary Order Entry Handler 1.1.1
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 <OnixS/ICE/BOE/ABI.h>
27
28#include <set>
29#include <string>
30
32
33ONIXS_ICEBOE_API_DECL(class, BgwSession);
34ONIXS_ICEBOE_API_DECL(struct, IBgwCredentialsProvider);
35
36namespace Scheduling {
37
38ONIXS_ICEBOE_API_DECL(class, SessionScheduler);
39
40typedef std::string SessionScheduleId;
41typedef std::string SessionConnectionSettingsId;
42
45{
46public:
53 virtual void onLoggingOut(const SessionScheduler& scheduler, Session* session, bool* allowLogout) ONIXS_ICEBOE_EMPTY_BODY(scheduler, session, allowLogout)
54
55
60 virtual void onWarning(const SessionScheduler& scheduler, Session* session, const std::string& warningReason) ONIXS_ICEBOE_EMPTY_BODY(scheduler, session, warningReason)
61
67 virtual void onError(const SessionScheduler& scheduler, Session* session, const std::string& errorReason)ONIXS_ICEBOE_EMPTY_BODY(scheduler, session, errorReason)
68
69protected:
71};
72
75{
76public:
78
80
82 const std::string & configurationFile() const noexcept;
83
85 SessionSchedulerOptions &configurationFile(const std::string &file);
86
89
92
93private:
94 std::string * configurationFile_;
95 SessionSchedulerListener * eventListener_;
96};
97
100{
101public:
102 static const size_t TimeResolutionMs = 10;
103
105
108
114
120
130 SessionScheduler& add(Session *session, const SessionSchedule &schedule, const SessionConnectionSettings &connection);
131
141 SessionScheduler &add(Session *session, const SessionScheduleId &scheduleId, const SessionConnectionSettingsId &connectionId);
142
152 SessionScheduler& add(BgwSession* session, const SessionSchedule& schedule, IBgwCredentialsProvider* bgwCredentialsProvider);
153
163 SessionScheduler& add(BgwSession* session, const SessionScheduleId& scheduleId, IBgwCredentialsProvider* bgwCredentialsProvider);
164
165
168
174
177
181 int reconnectAttempts() const;
182
185
189 int reconnectInterval() const;
190
193
197 bool utcTimeUsage() const;
198
199private:
200 class Impl;
201 Impl * impl_;
202};
203
204}
#define ONIXS_ICEBOE_NAMESPACE_BEGIN
Definition ABI.h:94
#define ONIXS_ICEBOE_EMPTY_BODY(...)
Definition ABI.h:121
#define ONIXS_ICEBOE_NAMESPACE_END
Definition ABI.h:98
#define ONIXS_ICEBOE_API_DECL(typeKind, typeName)
Definition ABI.h:27
#define ONIXS_ICEBOE_EXPORTED
Definition Compiler.h:155
virtual void onWarning(const SessionScheduler &scheduler, Session *session, const std::string &warningReason)
Notifies about a non-critical issue.
virtual void onError(const SessionScheduler &scheduler, Session *session, const std::string &errorReason)
Notifies about an error.
virtual void onLoggingOut(const SessionScheduler &scheduler, Session *session, bool *allowLogout)
Notifies that the session is about to be closed.
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(BgwSession *session, const SessionScheduleId &scheduleId, IBgwCredentialsProvider *bgwCredentialsProvider)
Adds the session to the automatic connection management.
SessionScheduler & add(Session *session, const SessionScheduleId &scheduleId, const SessionConnectionSettingsId &connectionId)
Adds the session to the automatic connection management.
SessionScheduler(const SessionSchedulerOptions &options)
SessionScheduler & add(BgwSession *session, const SessionSchedule &schedule, IBgwCredentialsProvider *bgwCredentialsProvider)
Adds the session to the automatic connection management.
const SessionConnectionSettings * findConnectionSettings(const SessionConnectionSettingsId &id) const
Looks for the predefined session connection settings associated with the given id that was specified ...
~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.
Interface to provide BGW session connection credentials.