image/svg+xml
  • OnixS .NET FIX Engine
  • Programming Guide
  • Api Documentation
  • Version 1.16.1
    • Programming Guide
    • Sessions
    • Scheduling Session for Automatic Connection
Show / Hide Table of Contents
  • Introduction
  • System Requirements
  • Project Dependency Management
  • Getting Started
  • Error Reporting
  • Licensing
  • Engine Initialization and Shutdown
  • Selecting FIX Version
  • FIX Message
    • Manipulating Message Fields
  • FIX Session
    • Establishing FIX Connection
    • Exchanging Messages
    • Message Sequence Numbers
  • Configuring the Engine
    • Loading Engine Settings From Configuration Files
    • Multiple Listen Ports
  • Logging Services
    • Selecting Session Storage
    • Customizing Message Logging
  • Threading Model
  • Thread Safety
  • Repeating Groups
  • Sessions
    • Session States
    • Session Events
    • Accepting FIX Session Without a Prior Creation of Session Object
    • Custom Logon Message
    • Logon Authentication
    • Establishing FIX Connection via Proxy
    • Asynchronous Logon/Logout
    • Resetting Message Sequence Numbers
    • Resetting Message Sequence Numbers via ResetSeqNumFlag Field
    • Resending Messages
    • Memory-based Session Storage
    • File-based Session Storage
    • Async File-based Session Storage
    • Pluggable Session Storage
    • Scheduling Session for Automatic Connection
      • Session Schedule
      • Session Connection Settings
      • XML-based Schedules and Connection Settings
    • Failover
    • Message Sending Latency
    • Message Receiving Latency
    • Message Throttling
  • Messaging
    • Manipulating Real Numbers
    • Message Validation
    • Serialized FIX Messages
    • Typed FIX Messages
    • Flat Messages
      • Flat Group Reader
    • Using LINQ
  • FIX Dictionary
    • XML-based Dictionary Description
    • Session-level Dictionary
    • Dictionary Exploration
    • Using QuickFIX Data Dictionary
  • Engine Events
  • TLS/SSL Encryption
    • Using TLS/SSL Encryption
    • Supported Certificates
    • Session-level TLS/SSL Settings
    • Verification of Client SSL Certificates
    • Custom verification of SSL Certificates
    • TLS/SSL Troubleshooting
  • FAST Coding
    • Encoding And Decoding Data Using FAST
    • FAST Template
    • Generating FIX Dictionaries For FAST Coding
    • FAST Exceptions
  • FIXML Converter
  • Reducing Garbage Collection Overhead
  • Best Practices
    • Low Latency Best Practices
    • High Throughput Best Practices
  • Migration Guide
  • Frequently Asked Questions
  • Glossary
  • External Resources
  • Samples
  • Support

Scheduling Session for Automatic Connection

The Sessions Scheduler service connects registered FIX sessions to counterparties at the beginning of the trading day and disconnects them at the end of a day.

It is also possible to keep a FIX Session connected for an entire trading week and disconnect it at the end of the last trading day.

The Sessions Scheduler is distributed as a stand-alone module.

Scheduler Class

The Scheduler is the main class of the Sessions Scheduler component.

Registering Session for Automatic Connection

The Register(Session, SessionSchedule, SessionConnectionSettings) member schedules a session for automatic login and logout per the given schedule.

For example:


SessionSchedule schedule = CreateSchedule();

scheduler.Register(session, schedule, new InitiatorConnectionSettings("localhost", 4500));

SessionSchedule CreateSchedule()
{
    const int logonDelayInSeconds = 5;
    TimeSpan logonTime = DateTime.Now.TimeOfDay.Add(new TimeSpan(0, 0, logonDelayInSeconds));

    const int connectionDurationInSeconds = 30;
    TimeSpan logoutTime = logonTime.Add(new TimeSpan(0, 0, logonDelayInSeconds + connectionDurationInSeconds));

    return new SessionSchedule(DayOfWeek.Sunday, DayOfWeek.Saturday, logonTime, logoutTime, SessionDuration.Day, SequenceNumberResetPolicy.Daily);
}

Removing Session from Scheduling Services

The Unregister(Session) method removes the given session from the scheduling services.

Note

Unregister(Session) does not disconnect an active session. Therefore, if a session has been already connected by the scheduler, it remains connected after unregistering.

Handling Scheduling Warnings and Errors

The Scheduler class exposes the Error event to notify about scheduling errors (e.g., failure to establish the session after the configured number of attempts).

Note

Once the Error event is raised by the scheduler, all attempts to log on the disconnected session will be suspended till the next logon time.

The Scheduler class exposes the Warning event to provide information about non-critical schedule-related errors.

For example:

scheduler.Warning += (object sender, OnixS.Fix.Scheduling.SessionWarningEventArgs e) =>
{
    Console.WriteLine($"Scheduler reported a warning for session {e.Session}: {e.Reason}");
};

scheduler.Error += (object sender, OnixS.Fix.Scheduling.SessionErrorEventArgs e) =>
{
    Console.WriteLine($"Scheduler reported an error for session {e.Session}: {e.Reason}");
};

Failure at Logon

In case of failure at logon, the scheduler will raise the Warning event and try to perform logon again as per ReconnectAttempts and ReconnectInterval values.

If the session remains disconnected after the configured number of connection attempts, the scheduler will raise Error event and stop all subsequent attempts to connect the session until the next logon time.

Scheduling Algorithm

  • If a session is registered during the time covered by the configured schedule, the scheduler will connect the session immediately.
  • If a session is registered after the logout and before the logon time, no attempts will be made to connect the session until the next logon time.
  • If a session is registered after the logout and before the logon time, and the session is in the Established state, it will be disconnected immediately.
  • In case of a logon failure, the scheduler tries to logon again per its reconnection settings (ReconnectAttempts and ReconnectInterval values).
  • In the TCP connection is broken, the FIX Engine tries to restore the connection per the ReconnectAttempts and ReconnectInterval values.
  • If a session is re-connected within reconnection attempts defined by the session configuration settings, no error will be reported by the scheduler.
  • In case of a graceful termination of the FIX Connection by the Logout message exchange before the scheduled logout time, the scheduler tries to log in the session again immediately.
  • If a session is being reconnected and the logout time is reached, the scheduler will stop further reconnection attempts and no error will be reported.

Scheduling Log

The Scheduler class uses the logging service configured during the FIX Engine initialization.

Run-time and XML-based configurations

The Session Scheduler supports API- and XML-based descriptions of schedules and connection settings.

See Also

  • Session Schedule
  • Session Connection Settings
  • XML-based Schedules and Connection Settings
  • The SessionScheduler sample from the FIX Engine distribution package
In this article
  • Scheduler Class
  • Registering Session for Automatic Connection
  • Removing Session from Scheduling Services
  • Handling Scheduling Warnings and Errors
  • Failure at Logon
  • Scheduling Algorithm
  • Scheduling Log
  • Run-time and XML-based configurations
  • See Also
Back to top Copyright © Onix Solutions.
Generated by DocFX