[QFJ-993] AbstractSocketAcceptor attempts to create SocketDescriptor for template session Created: 15/Apr/20  Updated: 19/Jun/20  Resolved: 19/Jun/20

Status: Closed
Project: QuickFIX/J
Component/s: Engine
Affects Version/s: 2.1.1
Fix Version/s: None

Type: Bug Priority: Default
Reporter: abeel Assignee: Unassigned
Resolution: Not a bug Votes: 0
Labels: QuickfixJ


 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) {



 Comments   
Comment by Christoph John [ 19/Jun/20 ]

Hmm, could you please elaborate where you see the problem? IMHO even dynamic sessions need a SocketAcceptPort to know on which port sessions should get accepted. The address that you assign to a session provider is just to do a lookup for a specific address when a connection comes in. It does not mean that you do not need to specify a SockketAcceptPort. What is the problem of specifying that port in your config?

I am closing this for now. Feel free to reopen if you think there still is a problem.

Generated at Sat Nov 23 01:05:09 UTC 2024 using JIRA 7.5.2#75007-sha1:9f5725bb824792b3230a5d8716f0c13e296a3cae.