A scoped Java and QuickFIX/J example showing a FIX 4.4 acceptor, Application callbacks, MessageCracker routing, and controlled shutdown.
A scoped Java and QuickFIX/J example showing a FIX 4.4 acceptor, Application callbacks, MessageCracker routing, and controlled shutdown.
A QuickFIX/J acceptor listens for a FIX session and passes inbound application messages to your code. This Java example uses QuickFIX/J 2.3.1 and FIX 4.4 to show session configuration, message routing, and shutdown. It is a learning example, not a production order-processing system.
Use the pinned dependency below in an existing Maven Java project. The version identifies the example tested here; verify release compatibility before selecting a version for a service.
<dependency>
<groupId>org.quickfixj</groupId>
<artifactId>quickfixj-all</artifactId>
<version>2.3.1</version>
</dependency>Save the following as config/server.cfg and replace both CompIDs with values agreed with the counterparty. Make the FIX 4.4 data dictionary available on the configured path or classpath.
[DEFAULT]
ConnectionType=acceptor
StartTime=00:00:00
EndTime=00:00:00
HeartBtInt=30
FileStorePath=store
FileLogPath=log
DataDictionary=FIX44.xml
[SESSION]
BeginString=FIX.4.4
SenderCompID=YOUR_SERVER_COMP_ID
TargetCompID=YOUR_CLIENT_COMP_ID
SocketAcceptPort=9876Application is an interface. The class implements it and extends MessageCracker to dispatch messages. fromApp receives application messages from the counterparty; it calls crack to invoke the typed onMessage handler. toApp is the outgoing application-message callback.
import quickfix.Application;
import quickfix.DoNotSend;
import quickfix.FieldNotFound;
import quickfix.IncorrectDataFormat;
import quickfix.IncorrectTagValue;
import quickfix.Message;
import quickfix.MessageCracker;
import quickfix.RejectLogon;
import quickfix.SessionID;
import quickfix.UnsupportedMessageType;
import quickfix.fix44.NewOrderSingle;
public class MyFIXApplication extends MessageCracker implements Application {
@Override public void onCreate(SessionID sessionID) {}
@Override public void onLogon(SessionID sessionID) {}
@Override public void onLogout(SessionID sessionID) {}
@Override public void toAdmin(Message message, SessionID sessionID) {}
@Override public void fromAdmin(Message message, SessionID sessionID)
throws FieldNotFound, IncorrectDataFormat, IncorrectTagValue, RejectLogon {}
@Override public void toApp(Message message, SessionID sessionID) throws DoNotSend {}
@Override
public void fromApp(Message message, SessionID sessionID)
throws FieldNotFound, IncorrectDataFormat, IncorrectTagValue, UnsupportedMessageType {
crack(message, sessionID);
}
public void onMessage(NewOrderSingle message, SessionID sessionID) throws FieldNotFound {
System.out.println("Received order " + message.getClOrdID().getValue());
}
}The handler logs an inbound NewOrderSingle identifier. It sends no acknowledgement and performs no order processing. Unimplemented message types are allowed to raise UnsupportedMessageType rather than being silently swallowed. See the QuickFIX/J application and message-receiving documentation for the callback contract.
import java.io.BufferedReader;
import java.io.InputStreamReader;
import quickfix.DefaultMessageFactory;
import quickfix.FileLogFactory;
import quickfix.FileStoreFactory;
import quickfix.SessionSettings;
import quickfix.SocketAcceptor;
public class FixServer {
public static void main(String[] args) throws Exception {
var settings = new SessionSettings("config/server.cfg");
var acceptor = new SocketAcceptor(
new MyFIXApplication(), new FileStoreFactory(settings), settings,
new FileLogFactory(settings), new DefaultMessageFactory());
acceptor.start();
try {
System.out.println("Acceptor started. Press Enter to stop.");
new BufferedReader(new InputStreamReader(System.in)).readLine();
} finally {
acceptor.stop();
}
}
}Before any live use, define authentication, transport protection, session recovery, durable state, duplicate handling, message validation, business authorization, and operational monitoring. Test the session with the actual counterparty protocol and failure cases. This example demonstrates the engine boundary only.
For related service design boundaries, read API security controls and JVM garbage-collector trade-offs.

Senior Technical Architect at HCLTech · working with Leonteq Security AG
I have 10+ years of experience building distributed systems and fintech platforms. I write about practical, non-obvious engineering details that official documentation often skips.
Scala, JVM, AI, and backend systems. I send practical articles when there is something worth reading.
Join the newsletter