-
Notifications
You must be signed in to change notification settings - Fork 14
FixServer
This section explains how to program a FIX server(FIX session acceptor).
Currently FIX server can be two types:
- Single Server Acceptor
- Multi Server Acceptor
Supports one acceptor per connection(server socket). First we create session id. FIX session acceptor needs to know bind host and bind port on which it will listen for inbound connections:
SessionIDBean sessionID = new SessionIDBean("Receiver", "Sender");
ServerSocketSessionAcceptor acceptor =
new SingleSessionAcceptor("localhost", 9999, FixVersion.FIX44, sessionID, new FixAcceptorSettings());
Supports several acceptors per connection(server socket). First we create session manager. Session manager needs to know how much inbound connections simultaneously to handle and which session ids to use:
SessionManager manager = new SimpleSessionManager(10);
SessionIDBean sessionID = new SessionIDBean("Receiver", "Sender");
manager.add(sessionID, new SampleSessionState());
You can add session id on fly as well. Further we create simple factory for creation of session acceptors(communicators):
ObjectFactory<FixSessionAcceptor> acceptorFactory = new ObjectFactory<FixSessionAcceptor>(){
@Override
public FixSessionAcceptor create() {
return new FixSessionAcceptor(FixVersion.FIX44, new FixAcceptorSettings());
}
};
FIX session acceptor needs to know bind host and bind port on which it will listen for inbound connections as well as logon timeout and logout timeout:
ServerSocketSessionAcceptor acceptor = new MultiSessionAcceptor("localhost", 9999, 1000, 1000, acceptorFactory, manager);
FIX Session instances that we created implement Runnable
:
new Thread(acceptor).start();
Missing something? Ask us a question