Search code examples
spring-bootkotlinfix-protocolquickfixj

Quickfix/j doesn't attempt to connect to the specified socket


I am using QuickFix/J 2.3.1 (same results with 2.3.0). I have a rather straightforward spring boot application, where a FIX service is one of the beans. It creates an initiator. Until recently everything worked fine. Suddenly I stumbled into the following issue - quickfix doesn't seem to even attempt to open a connection to the specified host:port. I do suspect that this can be something to do with my code, but so far I don't have a clue on how to figure out what is going on.

Here is the initialisation code (Kotlin):

    @PostConstruct
override fun start() {
    logger.info("Using config file {}", config.tradingServiceConfig.quickFixConfigFile)

    val sessionSettings = SessionSettings(config.tradingServiceConfig.quickFixConfigFile)
    val messageStoreFactory = FileStoreFactory(sessionSettings)
    val messageFactory = DefaultMessageFactory()
    initiator = SocketInitiator(
        this,
        messageStoreFactory,
        sessionSettings,
        SLF4JLogFactory(sessionSettings),
        messageFactory
    )
    logger.info("Calling initiator start")
    initiator?.start()

    logger.info("Initiator startup finished")
}

Here is the corresponding piece of log:

2021-12-12 22:20:48.962  INFO 94182 --- [  restartedMain] i.s.trading.gateway.service.FixService   : Calling initiator start
2021-12-12 22:20:49.157  INFO 94182 --- [  restartedMain] quickfix.DefaultSessionSchedule          : [FIX.4.2:XXX_STAGE_UAT->YYY_XXX_STAGE_UAT] daily, 08:00:00-UTC - 08:45:00-UTC
2021-12-12 22:20:49.180  INFO 94182 --- [  restartedMain] quickfixj.event                          : FIX.4.2:XXX_STAGE_UAT->YYY_XXX_STAGE_UAT: Session FIX.4.2:XXX_STAGE_UAT->YYY_XXX_STAGE_UAT schedule is daily, 08:00:00-UTC - 08:45:00-UTC
2021-12-12 22:20:49.181  INFO 94182 --- [  restartedMain] quickfixj.event                          : FIX.4.2:XXX_STAGE_UAT->YYY_XXX_STAGE_UAT: Session state is not current; resetting FIX.4.2:XXX_STAGE_UAT->YYY_XXX_STAGE_UAT
2021-12-12 22:20:49.185  INFO 94182 --- [  restartedMain] quickfixj.event                          : FIX.4.2:XXX_STAGE_UAT->YYY_XXX_STAGE_UAT: Created session: FIX.4.2:XXX_STAGE_UAT->YYY_XXX_STAGE_UAT
2021-12-12 22:20:49.186  INFO 94182 --- [  restartedMain] i.s.t.gateway.service.FixServiceBase     : New session started: FIX.4.2:XXX_STAGE_UAT->YYY_XXX_STAGE_UAT}
2021-12-12 22:20:49.193  INFO 94182 --- [  restartedMain] quickfix.mina.NetworkingOptions          : Socket option: SocketTcpNoDelay=true
2021-12-12 22:20:49.194  INFO 94182 --- [  restartedMain] quickfix.mina.NetworkingOptions          : Socket option: SocketSynchronousWrites=false
2021-12-12 22:20:49.194  INFO 94182 --- [  restartedMain] quickfix.mina.NetworkingOptions          : Socket option: SocketSynchronousWriteTimeout=30000
2021-12-12 22:20:49.276  INFO 94182 --- [  restartedMain] quickfixj.event                          : FIX.4.2:XXX_STAGE_UAT->YYY_XXX_STAGE_UAT: Configured socket addresses for session: [localhost/127.0.0.1:10669]
2021-12-12 22:20:49.277  INFO 94182 --- [  restartedMain] quickfix.SocketInitiator                 : SessionTimer started
2021-12-12 22:20:49.280  INFO 94182 --- [  restartedMain] i.s.trading.gateway.service.FixService   : Initiator startup finished
2021-12-12 22:20:49.280  INFO 94182 --- [ssage Processor] quickfix.SocketInitiator                 : Started QFJ Message Processor

No other FIX, including quickfix, messages appear in the log. And I can see via netstat that not even an attempt is made to connect to the specified socket. I tried stopping the process in debugger to see what was going on, but couldn't see anything obvious.

As I said before, this used to work just fine a week or so ago when I last tried, that's why I'm so puzzled.

Any thoughts on how to debug the issue?


Solution

  • You seem to have configured the initiator to connect to the acceptor on a daily basis, between 08:00:00-UTC and 08:45:00-UTC.

    Try increasing the date range (i. e. 08:00:00 to 18:00:00) and see if you get connected.

    PS: If you're using quickfixj and Spring, have a look at QuickFixJ Spring Boot starter in Github https://github.com/esanchezros/quickfixj-spring-boot-starter