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

AbstractSocketAcceptor attempts to create SocketDescriptor for template session

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Default
    • Resolution: Not a bug
    • Affects Version/s: 2.1.1
    • Fix Version/s: None
    • Component/s: Engine
    • Labels:

      Description

      configuration: quickfix.properties
      [DEFAULT]
      UseDataDictionary=Y

      [SESSION]
      AcceptorTemplate=Y
      ConnectionType=acceptor
      BeginString=FIX.4.4

      Code:

          public synchronized void start() {
              try {
                  final SLF4JLogFactory logger = new SLF4JLogFactory(this.sessionSettings);
      
                  this.acceptor = new SocketAcceptor(this.application,
                                                     this.messageStoreFactory,
                                                     this.sessionSettings,
                                                     logger,
                                                     this.msgFactory);
      
                  this.acceptor.setSessionProvider(new InetSocketAddress("0.0.0.0", 50000),
                                                   new DynamicAcceptorSessionProvider(
                                                           this.sessionSettings,
                                                           new SessionID("FIX.4.4", "SENDCOMPID", "TARGETCOMPID"),
                                                           this.application,
                                                           this.messageStoreFactory,
                                                           logger,
                                                           this.msgFactory));
                  this.acceptor.start();
              } catch (ConfigError ex) {
                  log.error("Failed to start QuickFIX-J socket acceptor.", ex);
                  this.acceptor = null;
              }
          }
      

      Throws:

      quickfix.ConfigError: SocketAcceptPort not defined
      at quickfix.SessionSettings.getString(SessionSettings.java:149) ~[quickfixj-core-2.1.1.jar:2.1.1]
      at quickfix.SessionSettings.getLong(SessionSettings.java:229) ~[quickfixj-core-2.1.1.jar:2.1.1]
      at quickfix.mina.acceptor.AbstractSocketAcceptor.getAcceptorSocketDescriptor(AbstractSocketAcceptor.java:189) ~[quickfixj-core-2.1.1.jar:2.1.1]
      at quickfix.mina.acceptor.AbstractSocketAcceptor.createSessions(AbstractSocketAcceptor.java:230) ~[quickfixj-core-2.1.1.jar:2.1.1]
      at quickfix.mina.acceptor.AbstractSocketAcceptor.startAcceptingConnections(AbstractSocketAcceptor.java:96) ~[quickfixj-core-2.1.1.jar:2.1.1]
      at quickfix.SocketAcceptor.initialize(SocketAcceptor.java:108) ~[quickfixj-core-2.1.1.jar:2.1.1]
      at quickfix.SocketAcceptor.start(SocketAcceptor.java:102) ~[quickfixj-core-2.1.1.jar:2.1.1]

      Issue seems to be with this code

      quickfix.mina.acceptor.AbstractSocketAcceptor
      private void createSessions(SessionSettings settings) throws ConfigError, FieldConvertError {
              HashMap<SessionID, Session> allSessions = new HashMap<>();
              for (Iterator<SessionID> i = settings.sectionIterator(); i.hasNext();) {
                  SessionID sessionID = i.next();
                  String connectionType = settings.getString(sessionID,
                          SessionFactory.SETTING_CONNECTION_TYPE);
      
                  boolean isTemplate = false;
                  if (settings.isSetting(sessionID, Acceptor.SETTING_ACCEPTOR_TEMPLATE)) {
                      isTemplate = settings.getBool(sessionID, Acceptor.SETTING_ACCEPTOR_TEMPLATE);
                  }
      
                  if (connectionType.equals(SessionFactory.ACCEPTOR_CONNECTION_TYPE)) {
                      AcceptorSocketDescriptor descriptor = getAcceptorSocketDescriptor(settings, sessionID);
                      if (!isTemplate) {
                          Session session = sessionFactory.create(sessionID, settings);
                          descriptor.acceptSession(session);
                          allSessions.put(sessionID, session);
                      }
                  }
              }
              setSessions(allSessions);
      
              if (socketDescriptorForAddress.isEmpty()) {
                  throw new ConfigError("No acceptor sessions found in settings.");
              }
          }

      // attempts to create descriptor for a session template

      if (connectionType.equals(SessionFactory.ACCEPTOR_CONNECTION_TYPE)) {
      * AcceptorSocketDescriptor descriptor = getAcceptorSocketDescriptor(settings, sessionID);*
      if (!isTemplate) {

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              awalga abeel
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: