Class Scheduler
Scheduler performs session connection maintenance according
to the specified schedule for session activities. It monitors
whenever criteria to log a particular session either on or off
is triggered and automatically executes appropriate action.
Implements
Inherited Members
Namespace: OnixS.Fix.Scheduling
Assembly: OnixS.Fix.Engine.dll
Syntax
public class Scheduler : IDisposable
Constructors
Scheduler()
Initializes Scheduler instance with default configuration.
Declaration
public Scheduler()
Scheduler(string)
Initializes Scheduler instance according to the options specified in given configuration file. In particular, Scheduler extracts from configuration a set of predefined session schedules and connection settings later available through Schedules and ConnectionSettings properties.
Declaration
public Scheduler(string configurationFile)
Parameters
Type | Name | Description |
---|---|---|
string | configurationFile | Path to the Scheduler's configuration. |
Properties
ConnectionSettings
Collection of predefined session connection settings associated with unique names (ids) as it was specified in the configuration file.
Declaration
public IDictionary<string, SessionConnectionSettings> ConnectionSettings { get; }
Property Value
Type | Description |
---|---|
IDictionary<string, SessionConnectionSettings> |
ReconnectAttempts
Number of attempts to restore the telecommunication link.
Declaration
public int ReconnectAttempts { get; set; }
Property Value
Type | Description |
---|---|
int |
ReconnectInterval
Time interval between the attempts to restore the telecommunication link (in seconds).
Declaration
public int ReconnectInterval { get; set; }
Property Value
Type | Description |
---|---|
int |
Schedules
Collection of predefined session schedules associated with unique names (ids) as it was specified in Scheduler's configuration file.
Declaration
public IDictionary<string, SessionSchedule> Schedules { get; }
Property Value
Type | Description |
---|---|
IDictionary<string, SessionSchedule> |
TimeZone
This property allows to setup time zone used for schedules. Default value is TimeZoneInfo.Local.
Declaration
public TimeZoneInfo TimeZone { get; set; }
Property Value
Type | Description |
---|---|
TimeZoneInfo |
UtcTimeUsage
This property allows switching local time to UTC time usage
Declaration
[Obsolete("Please use Scheduler.TimeZone = TimeZoneInfo.Utc", true)]
public bool UtcTimeUsage { get; set; }
Property Value
Type | Description |
---|---|
bool |
Methods
Dispose()
Performs graceful shutdown of scheduling services.
Declaration
public void Dispose()
~Scheduler()
Performs graceful shutdown of scheduling services.
Declaration
protected ~Scheduler()
Register(Session, SessionSchedule, SessionConnectionSettings)
Adds session to automatic connection management. If session is being added during active time frame, it will be connected immediately. If session is being registered during inactive time frame and has active state, it will be disconnected. If session already registered, exception will be thrown.
Declaration
public void Register(Session session, SessionSchedule schedule, SessionConnectionSettings connectionSettings)
Parameters
Type | Name | Description |
---|---|---|
Session | session | Session to be scheduled. |
SessionSchedule | schedule | Schedule which defines session connection time, periodicity as well as other attributes. |
SessionConnectionSettings | connectionSettings | Connection settings for given session to be used when session must be connected. |
Register(Session, SessionSchedule[], SessionConnectionSettings)
Adds session to automatic connection management. If session is being added during active time frame, it will be connected immediately. If session is being registered during inactive time frame and has active state, it will be disconnected. If session already registered, exception will be thrown.
Declaration
public void Register(Session session, SessionSchedule[] schedules, SessionConnectionSettings connectionSettings)
Parameters
Type | Name | Description |
---|---|---|
Session | session | Session to be scheduled. |
SessionSchedule[] | schedules | Schedules which defines session connection time, periodicity as well as other attributes. |
SessionConnectionSettings | connectionSettings | Connection settings for given session to be used when session must be connected. |
Register(Session, string, string)
Adds session to automatic connection management.
Declaration
public void Register(Session session, string scheduleId, string connectionSettingsId)
Parameters
Type | Name | Description |
---|---|---|
Session | session | Session to be scheduled. |
string | scheduleId | Id of predefined schedule to use for given session. |
string | connectionSettingsId | Id of predefined connection settings to use for given session. |
Register(Session, string[], string)
Adds session to automatic connection management.
Declaration
public void Register(Session session, string[] scheduleIds, string connectionSettingsId)
Parameters
Type | Name | Description |
---|---|---|
Session | session | Session to be scheduled. |
string[] | scheduleIds | Ids of predefined schedules to use for given session. |
string | connectionSettingsId | Id of predefined connection settings to use for given session. |
SessionDesiredState(Session)
Returns a desired state (Established or Disconnected), for the current time point, of the given session in accordance with the registered, for this session, schedule.
Declaration
public SessionState SessionDesiredState(Session registeredSession)
Parameters
Type | Name | Description |
---|---|---|
Session | registeredSession | Registered session which should be checked. |
Returns
Type | Description |
---|---|
SessionState | The desired state (Established or Disconnected), for the current time point, of the given session in accordance with the registered, for this session, schedule. |
SessionDesiredState(Session, DateTime)
Returns a desired state (Established or Disconnected), for the given UTC time point, of the given session in accordance with the registered, for this session, schedule.
Declaration
public SessionState SessionDesiredState(Session registeredSession, DateTime timeUtc)
Parameters
Type | Name | Description |
---|---|---|
Session | registeredSession | Registered session which should be checked. |
DateTime | timeUtc | Given UTC time point for checking. |
Returns
Type | Description |
---|---|
SessionState | The desired state (Established or Disconnected), for the given UTC time point, of the given session in accordance with the registered, for this session, schedule. |
Unregister(Session)
Removes session from automatic connection management services. If session were not registered before, does actually nothing.
Declaration
public void Unregister(Session session)
Parameters
Type | Name | Description |
---|---|---|
Session | session | Session which should be unregistered. |
Events
Error
Allows scheduler's users to be notified about errors
occurred while maintaining sessions connections.
Scheduler doesn't notify about all errors occurred
while maintaining session activity. For example, if
session was not connected within first time as well as
connection was dropped, scheduler will not fire error
event immediately. Instead, it will perform reconnection
attempts according to FIX Engine settings. Only if all
attempts will fail, scheduler will fire error event.
Once scheduler notified about inability to connect certain session, it will not perform more attempts to bring session to connected state until next logon (activity) time.
Declaration
public event EventHandler<SessionErrorEventArgs> Error
Event Type
Type | Description |
---|---|
EventHandler<SessionErrorEventArgs> |
InitiatorConnecting
Allows scheduler's users to be notified when initiator will try to connect to the next counterparty.
Declaration
public event EventHandler<InitiatorConnectingEventArgs> InitiatorConnecting
Event Type
Type | Description |
---|---|
EventHandler<InitiatorConnectingEventArgs> |
SessionLoggedOn
Allows scheduler's users to be notified about that scheduler performs session logon.
Declaration
public event EventHandler<SessionEventArgs> SessionLoggedOn
Event Type
Type | Description |
---|---|
EventHandler<SessionEventArgs> |
SessionLoggedOut
Allows scheduler's users to be notified about that scheduler performs session logout.
Declaration
public event EventHandler<SessionEventArgs> SessionLoggedOut
Event Type
Type | Description |
---|---|
EventHandler<SessionEventArgs> |
SessionLoggingOn
Allows scheduler's users to be notified about that scheduler wants to perform session logon.
Declaration
public event EventHandler<SessionEventArgs> SessionLoggingOn
Event Type
Type | Description |
---|---|
EventHandler<SessionEventArgs> |
SessionLoggingOut
Allows scheduler's users to be notified about that scheduler wants to perform session logout and control this process.
Declaration
public event EventHandler<SessionLoggingOutEventArgs> SessionLoggingOut
Event Type
Type | Description |
---|---|
EventHandler<SessionLoggingOutEventArgs> |
SessionResetLocalSequenceNumbers
Allows scheduler's users to be notified about that scheduler reset session local sequence numbers.
Declaration
public event EventHandler<SessionEventArgs> SessionResetLocalSequenceNumbers
Event Type
Type | Description |
---|---|
EventHandler<SessionEventArgs> |
SessionResettingLocalSequenceNumbers
Allows scheduler's users to be notified about that scheduler wants to reset session local sequence numbers.
Declaration
public event EventHandler<SessionEventArgs> SessionResettingLocalSequenceNumbers
Event Type
Type | Description |
---|---|
EventHandler<SessionEventArgs> |
Warning
Allows scheduler's users to be notified about warnings occurred while maintaining sessions connections.
Declaration
public event EventHandler<SessionWarningEventArgs> Warning
Event Type
Type | Description |
---|---|
EventHandler<SessionWarningEventArgs> |