I am writing a Spring Boot application that has a REST endpoint that takes a currency pair as input and responds with an exchange rate. I am planning to configure QuickFixJ as an initiator and use it to retrieve a quote. However I am unsure how to deal with Session
s. Do I define just one session section in my QuickFixJ config file (example config file below) and then use that single Session
for all my REST requests? If so, do I need to use the single Session
in a thread safe way?
[DEFAULT]
ConnectionType=initiator
ReconnectInterval=60
SenderCompID=SENDER
[SESSION]
BeginString=FIX.4.4
TargetCompID=TARGET
Are you using QFJ Spring Boot Starter? https://github.com/esanchezros/quickfixj-spring-boot-starter
But regardless if yes or no, eventually you (or the starter) will end up calling Session.send()
which can be called concurrently. It locks the outgoing sequence number until processing of one message is complete.
If you only have one FIX session, then you will only need to configure one session in your config file. If you have one or more sessions depends on against how much counterparties you want to connect to retrieve quotes.