Uploaded image for project: 'QuickFIX/J'
  1. QuickFIX/J
  2. QFJ-165

Allow for dynamic definition of sessions

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Default
    • Resolution: Fixed
    • Affects Version/s: 1.1.0
    • Fix Version/s: 1.3.0
    • Component/s: Engine
    • Labels:
      None
    • Environment:
      All

      Description

      As requested previously (http://www.quickfixj.org/jira/browse/QFJ-125), we have a few compelling use cases where we would like our QuickFIX/J-based server application to be able to update session descriptions on the fly.

      I have attached patches to the current SVN HEAD (621), that provide the basic facilities for dynamic session definition in QuickFIX.

      • Replaced the singleton "sessions" map in Session.java with an instance of the new interface ISessionDB
      • Created two implementations of ISessionDB, StaticSessionDB (which provides the same semantics as the original map singleton) and CachingSessionDB which creates a local cache of any session created by a SessionFactory (not sure how useful this is, but it is useful during prototyping and testing)
      • Added a "UseDynamicSessions" boolean configuration variable that can be used in the global scope of the configuration file.
      • Added a "useDynamicSessions" boolean constructor argument to AbstractSocketAcceptor and AbstractIoHandler to correspond to the configuration variable
      • AbstractSocketAcceptor now creates one socket descriptor for 0.0.0.0/0.0.0.0:<port> if there otherwise are none, and UseDynamicSessions is "Y", this makes it possible to have a configuration file with no explicit session sections, only a defaults.
      • If the AcceptorIOHandler does not have a Session in it's local map, it now calls Session.lookupSession() to find it, if useDynamicSessions is true

      And some potentially controversial changes:

      • Made the constructors of the Session object public, so that I could provide my own subclass of SessionFactory in my own package.
      • Made the class and constructor of SessionSchedule public, so that I could provide my own subclass of SessionFactory in my own package.
      • Made the DEFAULT_SESSION_ID in SessionSettings.java public, so that I could reuse some code in AbstractSocketAcceptor (see the diffs for AbstractSocketAcceptor.java)

      With all of these changes, it is now possible to start up a QuickFIX/J socket acceptor with a .properties file with only a global section, like this:

      ConnectionType=acceptor
      FileStorePath=output/data/server
      HeartBtInt=30
      StartTime=00:00:00
      EndTime=00:00:00
      ReconnectInterval=15
      ResetOnLogout=Y
      ResetOnDisconnect=Y
      SendResetSeqNumFlag=Y
      SocketAcceptPort=7001
      UseDynamicSessions=Y
      

      In order to make real use of it, you will need to implement your own SessionFactory: in the example below it is called MySessionFactory. I have an implementation of a SessionFactory that accepts all incoming session requests, I don't think it's useful in production, but we could maybe add it to the test code.

      MessageFactory messageFactory = new DefaultMessageFactory();
      MessageStoreFactory messageStoreFactory = new MemoryStoreFactory();
      Application application = new MyApplication();
      SessionSettings settings = getSettings();
      LogFactory logFactory = new ScreenLogFactory();
      SessionFactory sessionFactory = new MySessionFactory(settings, application, messageStoreFactory, messageFactory);
      SocketAcceptor acceptor = new SocketAcceptor(sessionFactory, settings);
      acceptor.start();
      

      Ultimately it would be nice to have a couple of standard implementations of SessionFactory that read session configuration data out of a DB, or an LDAP server.

        Attachments

          Issue Links

            Activity

            gmillermarket Graham Miller created issue -
            Hide
            toli Toli Kuznets added a comment -

            125 was actually never implemented

            Show
            toli Toli Kuznets added a comment - 125 was actually never implemented
            toli Toli Kuznets made changes -
            Field Original Value New Value
            Link This issue relates to QFJ-125 [ QFJ-125 ]
            gmillermarket Graham Miller made changes -
            Attachment dynamicsessions.patch [ 10081 ]
            Hide
            toli Toli Kuznets added a comment -

            fixing up markup to try and get it to show up "pretty"

            Show
            toli Toli Kuznets added a comment - fixing up markup to try and get it to show up "pretty"
            toli Toli Kuznets made changes -
            Description As requested previously (http://www.quickfixj.org/jira/browse/QFJ-125), we have a few compelling use cases where we would like our QuickFIX/J-based server application to be able to update session descriptions on the fly.

            I have attached patches to the current SVN HEAD (621), that provide the basic facilities for dynamic session definition in QuickFIX.
            * Replaced the singleton "sessions" map in Session.java with an instance of the new interface ISessionDB
            * Created two implementations of ISessionDB, StaticSessionDB (which provides the same semantics as the original map singleton) and CachingSessionDB which creates a local cache of any session created by a SessionFactory (not sure how useful this is, but it is useful during prototyping and testing)
            * Added a "UseDynamicSessions" boolean configuration variable that can be used in the global scope of the configuration file.
            * Added a "useDynamicSessions" boolean constructor argument to AbstractSocketAcceptor and AbstractIoHandler to correspond to the configuration variable
            * AbstractSocketAcceptor now creates one socket descriptor for 0.0.0.0/0.0.0.0:<port> if there otherwise are none, and UseDynamicSessions is "Y", this makes it possible to have a configuration file with no explicit session sections, only a defaults.
            * If the AcceptorIOHandler does not have a Session in it's local map, it now calls Session.lookupSession() to find it, if useDynamicSessions is true


            And some potentially controversial changes:
            * Made the constructors of the Session object public, so that I could provide my own subclass of SessionFactory in my own package.
            * Made the class and constructor of SessionSchedule public, so that I could provide my own subclass of SessionFactory in my own package.
            * Made the DEFAULT_SESSION_ID in SessionSettings.java public, so that I could reuse some code in AbstractSocketAcceptor (see the diffs for AbstractSocketAcceptor.java)

            With all of these changes, it is now possible to start up a QuickFIX/J socket acceptor with a .properties file with only a global section, like this:

            {code}
            ConnectionType=acceptor
            FileStorePath=output/data/server
            HeartBtInt=30
            StartTime=00:00:00
            EndTime=00:00:00
            ReconnectInterval=15
            ResetOnLogout=Y
            ResetOnDisconnect=Y
            SendResetSeqNumFlag=Y
            SocketAcceptPort=7001
            UseDynamicSessions=Y
            {/code}

            In order to make real use of it, you will need to implement your own SessionFactory: in the example below it is called MySessionFactory. I have an implementation of a SessionFactory that accepts all incoming session requests, I don't think it's useful in production, but we could maybe add it to the test code.

            {code}
            MessageFactory messageFactory = new DefaultMessageFactory();
            MessageStoreFactory messageStoreFactory = new MemoryStoreFactory();
            Application application = new MyApplication();
            SessionSettings settings = getSettings();
            LogFactory logFactory = new ScreenLogFactory();
            SessionFactory sessionFactory = new MySessionFactory(settings, application, messageStoreFactory, messageFactory);
            SocketAcceptor acceptor = new SocketAcceptor(sessionFactory, settings);
            acceptor.start();
            {/code}

            Ultimately it would be nice to have a couple of standard implementations of SessionFactory that read session configuration data out of a DB, or an LDAP server.
            As requested previously (http://www.quickfixj.org/jira/browse/QFJ-125), we have a few compelling use cases where we would like our QuickFIX/J-based server application to be able to update session descriptions on the fly.

            I have attached patches to the current SVN HEAD (621), that provide the basic facilities for dynamic session definition in QuickFIX.
            * Replaced the singleton "sessions" map in Session.java with an instance of the new interface ISessionDB
            * Created two implementations of ISessionDB, StaticSessionDB (which provides the same semantics as the original map singleton) and CachingSessionDB which creates a local cache of any session created by a SessionFactory (not sure how useful this is, but it is useful during prototyping and testing)
            * Added a "UseDynamicSessions" boolean configuration variable that can be used in the global scope of the configuration file.
            * Added a "useDynamicSessions" boolean constructor argument to AbstractSocketAcceptor and AbstractIoHandler to correspond to the configuration variable
            * AbstractSocketAcceptor now creates one socket descriptor for 0.0.0.0/0.0.0.0:<port> if there otherwise are none, and UseDynamicSessions is "Y", this makes it possible to have a configuration file with no explicit session sections, only a defaults.
            * If the AcceptorIOHandler does not have a Session in it's local map, it now calls Session.lookupSession() to find it, if useDynamicSessions is true


            And some potentially controversial changes:
            * Made the constructors of the Session object public, so that I could provide my own subclass of SessionFactory in my own package.
            * Made the class and constructor of SessionSchedule public, so that I could provide my own subclass of SessionFactory in my own package.
            * Made the DEFAULT_SESSION_ID in SessionSettings.java public, so that I could reuse some code in AbstractSocketAcceptor (see the diffs for AbstractSocketAcceptor.java)

            With all of these changes, it is now possible to start up a QuickFIX/J socket acceptor with a .properties file with only a global section, like this:

            {code}
            ConnectionType=acceptor
            FileStorePath=output/data/server
            HeartBtInt=30
            StartTime=00:00:00
            EndTime=00:00:00
            ReconnectInterval=15
            ResetOnLogout=Y
            ResetOnDisconnect=Y
            SendResetSeqNumFlag=Y
            SocketAcceptPort=7001
            UseDynamicSessions=Y
            {code}

            In order to make real use of it, you will need to implement your own SessionFactory: in the example below it is called MySessionFactory. I have an implementation of a SessionFactory that accepts all incoming session requests, I don't think it's useful in production, but we could maybe add it to the test code.

            {code}
            MessageFactory messageFactory = new DefaultMessageFactory();
            MessageStoreFactory messageStoreFactory = new MemoryStoreFactory();
            Application application = new MyApplication();
            SessionSettings settings = getSettings();
            LogFactory logFactory = new ScreenLogFactory();
            SessionFactory sessionFactory = new MySessionFactory(settings, application, messageStoreFactory, messageFactory);
            SocketAcceptor acceptor = new SocketAcceptor(sessionFactory, settings);
            acceptor.start();
            {code}

            Ultimately it would be nice to have a couple of standard implementations of SessionFactory that read session configuration data out of a DB, or an LDAP server.
            toli Toli Kuznets made changes -
            Assignee Steve Bate [ admin ] Toli Kuznets [ toli ]
            admin Steve Bate made changes -
            Fix Version/s 1.3.0 [ 10071 ]
            admin Steve Bate made changes -
            Status Open [ 1 ] Resolved [ 5 ]
            Resolution Fixed [ 1 ]
            toli Toli Kuznets made changes -
            Link This issue is related to QFJ-221 [ QFJ-221 ]
            admin Steve Bate made changes -
            Comment [ http://www.rtm.gov.my/html/forum/viewtopic.php?t=7787
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7786
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7785
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7784
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7783
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7782
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7781
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7780
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7779
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7778
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7777
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7776
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7775
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7774
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7773
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7772
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7771
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7770
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7769
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7768
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7767
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7766
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7765
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7764
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7763
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7762
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7761
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7760
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7759
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7758
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7757
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7756
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7755
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7754
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7753
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7752
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7751
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7750
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7749
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7748
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7747
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7746
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7745
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7744
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7743
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7742
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7741
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7740
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7739
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7738
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7737
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7736
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7735
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7734
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7733
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7732
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7731
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7730
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7729
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7728
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7727
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7726
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7725
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7724
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7723
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7722
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7721
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7720
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7719
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7718
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7717
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7716
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7715
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7714
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7713
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7712
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7711
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7710
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7709
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7708
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7707
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7706
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7705
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7704
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7703
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7702
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7701
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7700
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7699
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7698
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7697
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7696
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7695
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7694
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7693
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7692
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7691
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7690
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7689
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7688
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7684
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7683
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7682
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7681
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7680
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7679
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7678
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7677
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7676
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7675
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7674
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7673
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7672
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7671
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7670
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7669
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7668
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7667
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7666
            http://www.rtm.gov.my/html/forum/viewtopic.php?t=7665 ]
            jthoennes Jörg Thönnes made changes -
            Status Resolved [ 5 ] Closed [ 6 ]

              People

              • Assignee:
                toli Toli Kuznets
                Reporter:
                gmillermarket Graham Miller
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: